🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.eiffel
Article #1144

Re: Hungarian notation

#1144
From: Ross McKay
Date: Wed, 10 Jan 1996 06:47
44 lines
3003 bytes
Todd Knarr wrote:
> 
> In <hawkfish-0801960904580001@blv-pm3-ip24.halcyon.com>, hawkfish@punchdeck.com (Richard Wesley) writes:
> 
> >I've found it useful to use typedefs for all sorts of things like this.
> >Looping through a FooArray with a FooIndex is much more robust than using
> >a long or something.
> 
> I try to avoid syntactic-saccharine typedefs when possible. There's no
> language-level gain from typedef'ing an int or long to something else
> just for that, and it virtually requires an explosion of variables to
> deal with multiple arrays of different types. 
> [snip]

One very good reason to do such a thing is to specify a domain. You may 
decide, on initial analysis, that the domain of some thing is within
the limits of a 16-bit integer. Thus, you may (on some platforms) typedef
a short integer for it, and use the new type instead of short int in all
places where a variable is to be restricted to that particular domain.
If, at some later stage of the development process, you determine that
32 bits would be more appropriate, you only need to change the typedef
(and perhaps some memory access stuff, especially if using 80x86 ;-)

I agree that where the domain is known to always fit within all native
word sizes on all target platforms, an int is appropriate. In all other
cases, however, I would suggest that typedef'ing would be more 
appropriate .

> --
> Todd Knarr : tknarr@xmission.com      |  finger for PGP public key
>                                       |  Member, USENET Cabal
> 
> Seriously, I don't want to die just yet.  I don't care how
> good-looking they are, I! don't! want! to! die!"
>                                         -- Megazone ( UF1 )

-- 
// --------------------------------------------------------------------- //
// Ross McKay        | email: rosko@zeta.org.au | The opinions expressed //
// Soft Technologies | snail: GPO Box 562,      | are my own, not those  //
// Sydney, Australia |        Sydney 2001, Aus. | of my employers.       //
// --------------------------------------------------------------------- //
//  "Circumcision is no skin off my nose"  (grafitti seen in Ultimo)     //
// --------------------------------------------------------------------- //
Technical Details
Message-ID: <30F360F3.68B@zeta.org.au>
Path: arc1-ca.pugleaf.net!gidora.kralizec.net.au!root
References: <30C40F77.53B5@swsbbs.com> <30EF0415.6FE1@tus.ssi1.com> <1996Jan7.045815.8676@ohstpy> <4cpb00$nqk@news.xmission.com> <hawkfish-0801960904580001@blv-pm3-ip24.halcyon.com> <4csj8i$gsa@news.xmission.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!gidora.kralizec.net.au!root
From: Ross McKay <rosko@zeta.org.au>
Newsgroups: comp.lang.eiffel,comp.lang.ada,comp.edu,comp.lang.c,comp.lang.c++,comp.lang.modula2,comp.lang.modula3
Subject: Re: Hungarian notation
Date: Tue, 09 Jan 1996 22:47:15 -0800
Organization: Soft Technologies
Message-ID: <30F360F3.68B@zeta.org.au>
References: <30C40F77.53B5@swsbbs.com> <30EF0415.6FE1@tus.ssi1.com> <1996Jan7.045815.8676@ohstpy> <4cpb00$nqk@news.xmission.com> <hawkfish-0801960904580001@blv-pm3-ip24.halcyon.com> <4csj8i$gsa@news.xmission.com>
NNTP-Posting-Host: dialup41.syd1.zeta.org.au
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 2.0b3 (Win16; I)