Hi. The answer is that this feature is not in C. It is in C++, which may be why you think it ought to work. :-)
I too am amazed by tcc's speed. When I use it to compile gawk, though, three of my tests, all related to wide characters, fail. I haven't time to investigate why, though. HTH, Arnold > Date: Mon, 27 Dec 2010 14:50:06 +0100 > From: Stephan Beal <[email protected]> > To: [email protected] > Subject: [Tinycc-devel] static const not recognized as const value? > > Hi, TCCers! > > (This is my first post to the list.) > > Every now and then i write code like the following: > > static const size_t sz = 1024 * 2; > char buffer[sz]; > ... > > tcc complains that sz is not a constant expression, which "just doesn't seem > right" to me. It does of course accept: > > enum { sz = 1024 * 2 }; > char buffer[sz]; > > but i'm quite pedantic about type safety, and hate having to cast my enum > values to size_t (or whatever) during later calls which use the "sz" value. > > Is there a particular reason which tcc (0.9.25) doesn't recognize static > consts as const values? i understand that tcc doesn't support C99 vararrays, > but a static const isn't quite the same as using, e.g., a value passed to > the function as the array size. (Or maybe they are the same, from tcc's > point of view?) This behaviour has been, in recent months, the only place i > have to retroactively change code to make it work in tcc. > > :-? > > PS: tcc's speed amazes me every time i use it. See the second gray box at: > http://fossil.wanderinghorse.net/repos/whio/index.cgi/wiki/AmalgamationBuild > > -- > ----- stephan beal > http://wanderinghorse.net/home/stephan/ _______________________________________________ Tinycc-devel mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/tinycc-devel
