Am 18.11.2012 10:21, schrieb fir:
> It is sad to say so but there is some real
> and terrible stupidnes in c99. When i wrote
> programs in c (and I am involved c user) I
> just use const int for array boundaries but
> in c99 (and some previous too, terribly) it
> will not compile (see for example
> http://stackoverflow.com/questions/1712592/ ) It is terribly wrong
> thing for ppl who just wants to use const int to this
> purposes and not to use preprocesor - as I do.
> It is terribly stupidness in my opinion, it have to
> be changed.
To my knowledge this has been the way in C for ever. Are you complaining
about C99 not adopting the C++ style in treating a file-scope const
"variable" with a constant initializer as a constant [compile-time]
expression? Or are you suggesting that C90 handles this any better and
that C99 is actually a regression in this department?
In C++ you can actually do this and
const int foo = 10;
is implicitly static (file-scope) due to the top-level constness and foo
can be used as compile-time constant expression. This is by design
because B. Stroustrup doesn't like macros very much, either.
I sort of accepted this difference between C and C++. In C you just have
to #define something like this in order to be able to use it as the size
of a non-VL array. But I would appreciate it if this unnecessary
incompatibility went away...