q for the C hackers
Aaron Hope
Aaron.Hope at unh.edu
Tue Aug 19 02:50:01 EDT 2003
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.
aaron
BTW, Is there a reason why mailman isn't configured to set the
reply-to header?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mail.gnhlug.org/mailman/private/gnhlug-discuss/attachments/20030819/1f8f183d/attachment.bin
More information about the gnhlug-discuss
mailing list