From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,af40e09e753872c X-Google-Attributes: gidfac41,public X-Google-Thread: 109fba,f292779560fb8442 X-Google-Attributes: gid109fba,public X-Google-Thread: f8c65,30e368bdb3310fe5 X-Google-Attributes: gidf8c65,public X-Google-Thread: 103376,30e368bdb3310fe5 X-Google-Attributes: gid103376,public X-Google-Thread: 1014db,30e368bdb3310fe5 X-Google-Attributes: gid1014db,public X-Google-Thread: 10db24,30e368bdb3310fe5 X-Google-Attributes: gid10db24,public X-Google-Thread: 1008e3,30e368bdb3310fe5 X-Google-Attributes: gid1008e3,public From: willer@carolian.com (Steve Willer) Subject: Re: Hungarian notation Date: 1996/05/24 Message-ID: <31a4fbac.81197235@sqarc.sq.com>#1/1 X-Deja-AN: 156419724 sender: news@sq.com (News Administrator) references: <4adem2$b5s@mercury.IntNet.net> <4n6off$6e2@mikasa.iol.it> <3198F30F.2A2@zurich.ibm.com> <4nsg3f$liu@solutions.solon.com> <31a3b322.442404233@sqarc> organization: Carolian Systems, Toronto ON newsgroups: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2,comp.edu,comp.lang.eiffel Date: 1996-05-24T00:00:00+00:00 List-Id: dewar@cs.nyu.edu (Robert Dewar) wrote: >For example, Steve Willer wrote: > >> myZ->Something = 3; >> >>First of all, I'll never remember that myZ is a pointer and Something is >>an int. I can't rely on my memory and I certainly can't rely on some >>other maintainer's ability to memorize my code. > >What ON EARTH is that "3" doing in the code? It is a simple example line of code, set up as a quick illustration of naming conventions. It is not intended to be an example of wonderful programming practices. >It is absolutely elementary >that bogus untyped, unnamed constants of this type do not belong in properly >written code, but I am sure that this point also escapes HN advocates. That's an unfair characterisation. What I have been trying to say is that I find my own naming convention gives me a useful buffer between my keyboard and the language's type-checking system (which is imperfect). It gives me an opportunity to proofread the code _before_ the compiler sees it. >It is truly remarkable that people would work with a language like C, and >decide that the one problem with the language was that it provides too >much data abstraction (in the form of abstract variable names), and that >even this much abstraction is anathema and must be system >atically eliinated. I certainly never said it provides too much data abstraction. What I'm saying is if you are using member variables or function arguments, you need to be aware of certain aspects of the variable or argument so you don't inadvertently shoot yourself in the foot. Examples are giving a float to a function that expects an int, giving a pointer to a function that expects a long, giving a pointer that you own to a function that expects an auto_ptr. This is not about 100% pure data abstraction; I think it is clear that that is just not attainable in C or C++. This is, in fact, about compromise and decisions based on costs vs. benefits.