Subj : Re: Win98 error To : borland.public.cpp.borlandcpp From : maeder@glue.ch (Thomas Maeder [TeamB]) Date : Fri Mar 12 2004 10:33 pm Bob Gonder writes: >>> #define nmax 100 >> >>Why would one even consider doing this? > > Probably because of my ASM background, I don't like creating variables > that should be "immediate" values. But this const int nmax=100; is not a variable. It's a const. If used like a macro can be used, it has an "immediate" value, like a macro. Additionally, it's address can be taken. And it can belong in a namespace, avoiding to contribute to global namespace "pollution". Short, it has *all* the uses the macro version has; then, it has more uses; but it hasn't any of the problems macros have. I'd consider defining nmax as a macro a bug. > And,I usually have sizes global (or at least modular) in scope. > And, it just looks too much like BASIC, initializing array sizes by > the contents of a variable. It's *not* a variable. It's a const. > I suppose the "const" in front of it makes it all right, but it gives me > the willies. I can't challenge that, of course :-) .