[Toybox] Any language lawyers here?
Rob Landley
rob at landley.net
Wed Feb 22 05:35:22 PST 2012
I'm arguing with C:
If I do the equivalent of:
extern int blah[] = {0,1,2,3,4};
int main(int argc, char *argv[])
{
printf("sizeof(blah)=%d\n", (int)sizeof(blah));
return 0;
}
I get:
temp.c:3: warning: ‘blah’ initialized and declared ‘extern’
But if I just have extern into blah[] without the initialization, I get:
temp.c: In function ‘main’:
temp.c:7: error: invalid application of ‘sizeof’ to incomplete type ‘int[]’
The second of which at least makes sense. The first is just stupid. I
want to have one common instance of the kill signal list, _and_ I want
various things to be aware how big the size of the thing is, and the
compiler's determined to give me a warning for doing something which I
_believe_ the language allows...
Is there some kind of "yes I know what I'm doing, shut up gcc"
annotation I can put on that line without having to hardwire in a
constant and maintain it by hand? (I want to make the extern a #define
which lib/lib.c can set to semicolon or something, and everybody else
can have as "extern"...)
Rob
1329917722.0
More information about the Toybox
mailing list