const, volatile, etc

Griff Smith ggs at ulysses.homer.nj.att.com
Sat Dec 3 06:52:53 AEST 1988


In article <9033 at smoke.BRL.MIL>, gwyn at smoke.BRL.MIL (Doug Gwyn ) writes:
> In article <10919 at ulysses.homer.nj.att.com> ggs at ulysses.homer.nj.att.com (Griff Smith) writes:
| ...
> >The response I got from a C++ guru around here wasn't encouraging: he
> >suggested declaring everything volatile and ignoring the issue.
> 
> Maybe he was joking?

Could be, but he seemed serious.  This was in response to a question
about bug search and destroy missions directed toward existing working
code.  I think the implication was that fixing old code to work with
new compilers is boring; just sweep the problem under the rug and be
done with it.  Do it right when you write something new.

> >Maybe he's right, but that attitude could easily lead to a habit of
> >forcing all declarations to include the volatile qualifier just to
> >avoid a `silly' rule.
| 
> No, that's not the proper way to use "volatile".

I know that.  The point was that `some' variable needed to be declared
volatile, and it was easier to fix them all rather than find the right
one using reasoning.

> >Do any of you have some practical experience, plus suggestions for
> >living in the brave new ANSI-C world?
| 
> I have a "standard C language assist" file <std.h> that I configure
> for each system I port to, and that I include in each source file of
> my applications.

Good start.  Now, what do I do about upgrading a million lines of old
code to the new standard, and finding all the mis-declared variables.
-- 
Griff Smith	AT&T (Bell Laboratories), Murray Hill
Phone:		1-201-582-7736
UUCP:		{most AT&T sites}!ulysses!ggs
Internet:	ggs at ulysses.att.com



More information about the Comp.lang.c mailing list