tinycc-devel
[Top][All Lists]
Advanced

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

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


From: Stephan Beal
Subject: Re: [Tinycc-devel] Re: static const not recognized as const value?
Date: Tue, 28 Dec 2010 10:36:13 +0100

On Mon, Dec 27, 2010 at 11:37 PM, Jared Maddox <address@hidden> wrote:
Although the array can be allocated at compile-time, the example you
provide is almost guaranteed to be classified as a vararray by the
standard.

i wasn't aware that static consts were "less const" than enums. i can live with that.
 
Incidentally, why are you being pedantic on size_t? Are you worried
about accidentally exceeding it's bounds?

Not about size_t specificially, just in general. enums are int-compatible (signed), and i am overly-pedantic about numeric types because i've had so much grief with them in the past when moving code from 32- to 64-bit platforms. In fact, i don't use size_t in my own code because it has an unspecified size and has no portable printf/scanf specifier, and those have been a primary culprit when i've had problems moving between 32/64 bits. i tend to use only the fixed-size <stdint.h> types (int32_t, etc.) because of their guaranteed sizes and the portable printf/scanf specifiers provided in <inttypes.h> (both are part of C99). (That practice also makes the sizes of my structs more predictable across platforms, because of the guaranteed sizes.)

> By only using the enum to
initialize the array and variable, and then using the variable
everywhere else, you should be able to get the accurate figure
everywhere, even if it isn't always the 'right' value.

i agree, i just prefer to use the "proper" type and value. No big deal, though. The  Standard takes precedence over my personal quirks.

Thanks for the response,

--
----- stephan beal
http://wanderinghorse.net/home/stephan/

reply via email to

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