tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] static const not recognized as const value?


From: Stephan Beal
Subject: [Tinycc-devel] static const not recognized as const value?
Date: Mon, 27 Dec 2010 14:50:06 +0100

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/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]