comp.lang.ada
 help / color / mirror / Atom feed
From: tknarr@xmission.com  ( Todd Knarr )
Subject: Re: Hungarian notation
Date: 1996/01/09
Date: 1996-01-09T00:00:00+00:00	[thread overview]
Message-ID: <4csj8i$gsa@news.xmission.com> (raw)
In-Reply-To: hawkfish-0801960904580001@blv-pm3-ip24.halcyon.com

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. The result of using several
different variables to step through several different arrays at different
times, just because those arrays have elements of different types, tends
to be confusion. When the index is really significant then it makes sense
to use seperate variables ( eg. when nCurrentMerchItem holds the index of
the current item as other processing is done ), but as was pointed out
there are a lot of constructions where the index is only significant for
a line or two of code ( where your code is saying, basically, "Do >this<
to every item in the array." ).

One of my rules is that, when I do something like that, I use integer
variables like i and j. That maps nicely to the uses of such letters in
math classes and the like. I can then tell instantly whether the indexes
are significant or just grind work.

>This is reasonable for C, but these days I find myself using auto_ptr and
>my own auto_array templates to deal with this problem.  On the other hand,
>it could still be useful inside a class that used an array to represent
>something (e.g. a string).

Even in a lot of higher-level things like your auto_array it makes sense
to index things by an integral value. There's a significant gain in safety
at times, but at others you simply introduce redundant checks. If, for
instance, an index is validated once and never altered after that, there
is no need to revalidate it on every access. ( NB: being certain the index
will never become invalid is, of course, the trick. )

--
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 )





  parent reply	other threads:[~1996-01-09  0:00 UTC|newest]

Thread overview: 172+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <30C40F77.53B5@swsbbs.com>
     [not found] ` <marnoldDJEvtJ.1Lx@netcom.com>
     [not found]   ` <4aleun$jlk@ns.RezoNet.NET>
     [not found]     ` <marnoldDJMDBG.CFz@netcom.com>
     [not found]       ` <4asnkr$7b0@solutions.solon.com>
     [not found]         ` <4ath75$e7i@barnacle.iol.ie>
     [not found]           ` <4b4kij$svt@news.microsoft.com>
     [not found]             ` <dewar.819489496@schonberg>
1996-01-08  0:00               ` Hungarian notation Michael Feathers
     [not found]               ` <4bd <4cne0e$1020@seminole.gate.net>
1996-01-08  0:00                 ` Bob Kitzberger
1996-01-08  0:00                 ` Adam Beneschan
     [not found] ` <30EF0415.6FE1@tus.ssi1.com>
     [not found]   ` <1996Jan7.045815.8676@ohstpy>
     [not found]     ` <4cpb00$nqk@news.xmission.com>
1996-01-08  0:00       ` Michael Feathers
1996-01-08  0:00         ` vancleef
1996-01-09  0:00         `  Todd Knarr 
1996-01-09  0:00           ` Michael Feathers
     [not found]       ` <hawkfish-0801960904580001@blv-pm3-ip24.halcyon.com>
1996-01-09  0:00         `  Todd Knarr  [this message]
     [not found] ` <4cd8fc$oud@news.manawatu.gen.nz>
1996-01-08  0:00   ` Joachim Durchholz
     [not found] ` <4fc157$jsf@goanna.cs.rmit.EDU.AU>
     [not found]   ` <dewar.823793746@schonberg>
     [not found]     ` <4fms62$c0p@goanna.cs.rmit.EDU.AU>
     [not found]       ` <4ft1ruINN6dr@keats.ugrad.cs.ubc.ca>
1996-02-19  0:00         ` Hungarian notation - whoops! Richard A. O'Keefe
1996-02-21  0:00           ` Lawrence Kirby
1996-02-22  0:00           ` Kazimir Kylheku
1996-02-19  0:00 ` Number representation (was: Hungarian notation - whoops!) Richard A. O'Keefe
1996-05-15  0:00 Hungarian notation Bob Crispen
     [not found] <4adem2$b5s@mercury.IntNet.net>
     [not found] ` <4ahka7$o9m@inrou.erno.de>
1996-05-13  0:00   ` Roger Merritt
1996-05-14  0:00     ` The Right Reverend Colin James III
1996-05-15  0:00       ` Graham Perkins
1996-05-15  0:00         ` Peter Seebach
1996-05-16  0:00           ` Pete Becker
1996-05-14  0:00     ` David Priest
1996-05-14  0:00     ` Keith Whittingham
1996-05-14  0:00       ` Dave Mikesell
1996-05-14  0:00       ` Peter Seebach
1996-05-14  0:00         ` Pete Becker
     [not found]           ` <4ndb2j$1p0q@uni.library.ucla.edu>
1996-05-16  0:00             ` Mark Chu-Carroll
1996-05-16  0:00               ` Jay Martin
1996-05-17  0:00                 ` Scott
1996-05-23  0:00                 ` G.O.Visser
1996-05-16  0:00             ` Steve Branam
1996-05-16  0:00             ` Scott
1996-05-16  0:00               ` Giuliano Carlini
1996-05-18  0:00                 ` Warren Young
1996-05-16  0:00         ` Matt Kennel
1996-05-14  0:00       ` Dr S.J. Harris
1996-05-15  0:00         ` Gerolf Wendland
1996-05-16  0:00           ` mAg
1996-05-17  0:00             ` Arne W Flones
1996-05-21  0:00               ` Norman L. Reitzel   
1996-05-21  0:00                 ` Richard A. O'Keefe
1996-05-22  0:00                   ` Peter Moylan
1996-05-23  0:00                     ` Robert Dewar
1996-05-23  0:00                       ` Steve Willer
1996-05-28  0:00                         ` Richard A. O'Keefe
1996-05-29  0:00                           ` Kevin Cline
1996-05-24  0:00                       ` Kevin Cline
1996-05-25  0:00                         ` Steve Willer
1996-06-05  0:00                         ` Ralph Silverman
1996-06-06  0:00                           ` Richard A. O'Keefe
1996-06-06  0:00                           ` James McKim
1996-06-07  0:00                             ` Ralph Silverman
1996-05-24  0:00                       ` Jeff Dege
1996-05-26  0:00                       ` Warren Young
1996-05-23  0:00                     ` Andy Ho-Fan Chan
1996-05-23  0:00                       ` Robert Dewar
1996-05-24  0:00                         ` Bob Rodgers
1996-05-24  0:00                         ` Robert A Duff
1996-05-28  0:00                           ` Richard A. O'Keefe
1996-05-28  0:00                             ` Janus
1996-05-28  0:00                             ` Jeff Dege
1996-05-29  0:00                             ` Chris Kuan
1996-05-29  0:00                               ` Bob Rodgers
1996-05-30  0:00                                 ` Chris Kuan
1996-05-29  0:00                             ` Michael Furman
1996-05-31  0:00                               ` Richard A. O'Keefe
1996-06-01  0:00                                 ` Warren Young
1996-06-01  0:00                                 ` Steve Willer
1996-06-03  0:00                                   ` Warren Young
1996-05-31  0:00                             ` Will Rose
1996-06-05  0:00                               ` Ralph Silverman
1996-06-07  0:00                                 ` Michael Furman
1996-06-01  0:00                             ` Heinz Hemken
1996-06-02  0:00                               ` Matt Kennel
1996-06-02  0:00                               ` Jeff Dege
1996-06-05  0:00                               ` Ralph Silverman
1996-06-06  0:00                                 ` Jeff Dege
1996-05-27  0:00                       ` Peter Moylan
1996-05-27  0:00                         ` Jeff Dege
1996-05-27  0:00                           ` The Amorphous Mass
1996-05-28  0:00                             ` Jeff Dege
1996-05-28  0:00                               ` The Amorphous Mass
1996-05-28  0:00                       ` Richard A. O'Keefe
1996-06-06  0:00                       ` Sam Hunting
1996-06-06  0:00                       ` Ralph Silverman
1996-06-06  0:00                         ` David Hopkins
1996-06-07  0:00                         ` Richard A. O'Keefe
1996-06-07  0:00                           ` Steve Willer
1996-06-10  0:00                             ` Michael Furman
1996-06-12  0:00                               ` Warren Young
1996-06-03  0:00                     ` Norman H. Cohen
1996-05-21  0:00                 ` Bob Rodgers
1996-05-22  0:00                   ` Matt Kennel
1996-05-23  0:00                     ` Steve Willer
1996-05-23  0:00                       ` Richard A. O'Keefe
1996-05-23  0:00                         ` Steve Willer
1996-05-23  0:00                     ` Bob Rodgers
1996-05-23  0:00                       ` Peter Seebach
1996-05-22  0:00                   ` Michael Furman
1996-05-23  0:00                   ` Peter Moylan
1996-06-10  0:00                 ` Ralph Silverman
1996-05-18  0:00             ` Richard Riehle
1996-05-23  0:00             ` Robert I. Eachus
1996-05-23  0:00             ` James Kanze US/ESC 60/3/141 #40763
1996-05-23  0:00               ` Paul J. Kossick
1996-05-25  0:00                 ` Raoul De Kezel
1996-05-23  0:00             ` Laurent Guerby
1996-06-05  0:00             ` Ralph Silverman
1996-06-05  0:00               ` jthorpe
1996-06-06  0:00               ` Richard A. O'Keefe
1996-06-07  0:00                 ` Chris Kuan
1996-06-07  0:00                 ` Ralph Silverman
1996-06-07  0:00                   ` The Amorphous Mass
1996-06-10  0:00                   ` Michael Furman
1996-06-11  0:00                   ` Richard A. O'Keefe
1996-06-11  0:00                     ` Will Rose
1996-06-11  0:00                     ` Kevin Cline
1996-06-11  0:00                       ` Chris Engebretson
1996-06-11  0:00                       ` Ralph Silverman
1996-06-12  0:00                       ` Bob Rodgers
1996-06-12  0:00                         ` Matt Kennel
1996-06-13  0:00                           ` Giuliano Carlini
1996-06-13  0:00                           ` Jeff Dege
1996-06-22  0:00                       ` Richard Green
1996-06-05  0:00           ` Ralph Silverman
1996-05-16  0:00       ` Dave Toland
1996-05-21  0:00       ` mAg
1996-05-21  0:00         ` Mark A Biggar
1996-05-21  0:00           ` slary61
1996-05-21  0:00         ` Peter Seebach
1996-05-23  0:00           ` Steve Willer
1996-05-23  0:00             ` Peter Seebach
1996-05-23  0:00             ` Robert Dewar
1996-05-24  0:00               ` slary61
1996-05-24  0:00                 ` Ian Ward
1996-05-24  0:00                 ` Jeff Dege
1996-05-24  0:00                 ` Jerry Kuch
1996-05-24  0:00                 ` Dave Toland
1996-05-24  0:00                 ` Jos A. Horsmeier
1996-05-26  0:00                   ` Richard Riehle
1996-05-27  0:00                     ` Warren Young
1996-06-03  0:00                     ` Eva
1996-05-28  0:00                   ` Paul D. DeRocco
1996-05-27  0:00                 ` Norman L. Reitzel   
1996-05-27  0:00                   ` Matt Kennel
1996-05-28  0:00                 ` Richard A. O'Keefe
1996-05-28  0:00                   ` Jay Martin
1996-05-29  0:00                     ` Richard A. O'Keefe
1996-06-01  0:00                     ` Michael Feldman
1996-05-29  0:00                 ` AJ Musgrove
1996-06-05  0:00                 ` Ralph Silverman
1996-06-06  0:00                 ` Ralph Silverman
1996-05-24  0:00               ` Steve Willer
1996-05-23  0:00             ` Richard A. O'Keefe
1996-05-23  0:00               ` Robert Dewar
1996-05-28  0:00                 ` Richard A. O'Keefe
1996-05-23  0:00               ` Bob Rodgers
1996-05-23  0:00                 ` Bob Kitzberger
1996-05-23  0:00               ` Train
1996-05-23  0:00                 ` jeffos2
1996-05-21  0:00         ` Bob Lang 3P21 x3172
1996-05-24  0:00         ` Oleg Kagan
1996-06-05  0:00           ` Ralph Silverman
1996-05-23  0:00     ` James Kanze US/ESC 60/3/141 #40763
1996-05-28  0:00     ` Homonnai Misi
1996-05-28  0:00     ` Brian Rogoff
1996-05-20  0:00   ` James Kanze US/ESC 60/3/141 #40763
1996-05-20  0:00     ` Tom Wheeley
1996-05-23  0:00     ` Steve Willer
1996-05-22  0:00   ` James Kanze US/ESC 60/3/141 #40763
1996-05-23  0:00   ` James Kanze US/ESC 60/3/141 #40763
1996-05-23  0:00     ` Richard Kenner
1996-06-01  0:00   ` Jim Kingdon
  -- strict thread matches above, loose matches on Subject: below --
1996-06-10  0:00 Bob Crispen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox