q for the C hackers

Bob Bell bbell at hp.com
Tue Aug 19 08:46:09 EDT 2003


On Tue, Aug 19, 2003 at 02:50:01AM -0400, Aaron Hope <Aaron.Hope at unh.edu> wrote:
> On Mon, 2003-08-18 at 20:13, Erik Price wrote:
> > However, what is the convention in C?  There seem to be two fine ways 
> > of doing it -- using the preprocessor, or the const keyword:
> > 
> > #define NUMBER_OF_UNITS 8
> > 
> > const int NUMBER_OF_UNITS = 8;
> 
> Generally, the more the compiler knows, the better it can do it's job,
> so I usually prefer the latter.  There are still some places in C (C99
> specifically) where you you have no choice but to use macros, like array
> declarations.  I believe that C++ const variables can be used wherever a
> simple #define can.

    Actually, the following is valid C99:
        const int m = 10;
        int
        foo(int n) {
            char s[n];
            char t[m];
        ...
        }

> BTW, Is there a reason why mailman isn't configured to set the 
> reply-to header?

    Because we don't want it to.  Can we not go there again?  Convince
your mailer to set Mail-Followup-To, if you'd like (mutt does that).

-- 
Bob Bell <bbell at hp.com>
-------------------------------------------------------------------------
 "If the only tool you have is a hammer, you tend to see every
  problem as a nail."
   -- Abraham Maslow



More information about the gnhlug-discuss mailing list