comp.lang.ada
 help / color / mirror / Atom feed
From: Hyman Rosen <hymie@prolifics.com>
Subject: Re: scope and/or parameters (beginner)
Date: 1999/04/15
Date: 1999-04-15T17:52:36+00:00	[thread overview]
Message-ID: <371627B2.BA3E914C@prolifics.com> (raw)
In-Reply-To: 7f51r8$m5r$1@nnrp1.dejanews.com

Robert Dewar wrote:
> You also have to consider the knowledge base, i.e. do
> programmers know all the relatively new stuff in the ANSI
> C standard, and can they count on maintenance programmers
> to know it.
> 
> When it comes to const, this is of course an important
> feature, but it does not BEGIN to have become standard
> practice in C code, and indeed virtually all API's I
> have worked with seem to prefer to use #define in the
> traditional manner to using const. This is not a decision
> I approve of, I am merely making an observation, it takes
> time for things to change.

I don't think that the dearth of const in C code is because of lack
of knowledge. The problem with const is that it is infectious where
it is most needed, with respect to pointers. Once an object is const,
pointers to that object can not be passed as parameters to routines
which expect non-const pointers (unless casts are used). Unfortunately,
many APIs predate const, and so use non-const pointers even when they
do not modify the pointed-to data.

As far as const-vs.-#define, you cannot use const objects as parts of
constant expressions in C. (You can in C++.) The best way to declare
integer constants in C is through enum.




  reply	other threads:[~1999-04-15  0:00 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-02  0:00 scope and/or parameters (beginner) fluffy_pink
1999-04-03  0:00 ` Matthew Heaney
1999-04-05  0:00 ` Corey Ashford
1999-04-05  0:00   ` fluffy_doo
1999-04-06  0:00     ` Matthew Heaney
1999-04-08  0:00     ` czgrr
1999-04-10  0:00       ` fluffy_puff
1999-04-12  0:00       ` dennison
1999-04-13  0:00         ` Robert Dewar
1999-04-13  0:00         ` czgrr
1999-04-13  0:00           ` Robert Dewar
1999-04-14  0:00             ` czgrr
1999-04-14  0:00               ` Robert Dewar
1999-04-15  0:00                 ` czgrr
1999-04-15  0:00                   ` Robert Dewar
1999-04-14  0:00               ` dennison
1999-04-13  0:00     ` Robert A Duff
1999-04-14  0:00       ` Robert Dewar
1999-04-14  0:00         ` Hyman Rosen
1999-04-14  0:00           ` dennison
1999-04-14  0:00             ` Hyman Rosen
1999-04-14  0:00               ` dennison
1999-04-14  0:00                 ` Hyman Rosen
1999-04-15  0:00                   ` dennison
1999-04-15  0:00                     ` Robert Dewar
1999-04-15  0:00                       ` Hyman Rosen [this message]
1999-04-15  0:00                       ` dennison
1999-04-15  0:00           ` Robert Dewar
1999-04-15  0:00             ` Hyman Rosen
1999-04-15  0:00               ` Robert Dewar
1999-04-15  0:00                 ` Hyman Rosen
1999-04-16  0:00               ` Rakesh Malhotra
1999-04-15  0:00       ` fluffy_dong
1999-04-15  0:00         ` Robert Dewar
1999-04-15  0:00           ` dennison
1999-04-15  0:00             ` fluffy_dong
1999-04-16  0:00               ` Robert Dewar
1999-04-16  0:00                 ` Fraser Wilson
1999-04-16  0:00                   ` Gautier.DeMontmollin
1999-04-20  0:00                     ` Nick Roberts
1999-04-21  0:00                     ` fraser
1999-04-22  0:00               ` Robert A Duff
1999-04-22  0:00                 ` Larry Kilgallen
1999-04-16  0:00         ` Samuel Mize
replies disabled

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