J
jacob navia
Consider this code
static typedef struct {
int boo;
} FOO;
This provokes with MSVC:
------------------------------
Microsoft (R) C/C++ Optimizing Compiler Version 14.00.50727.762 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
tstruct.c
tstruct.c(1) : error C2159: more than one storage class specified
------------------------------
With gcc we have:
----------------------------
root@ubuntu-vm:/tmp# gcc t.c
t.c:1: error: multiple storage classes in declaration specifiers
----------------------------
With lcc-win I had
Warning tstruct.c: 1 multiple types in a declaration. Last will be
used: 'typedef'
with lcc-win64
------------------------------
Warning tstruct.c: 1 multiple use of 'typedef'
------------------------------
All those warnings are misleading in my opinion. I have changed the
wording to:
Warning tstruct.c: 1 typedefs can't be static. Static keyword ignored
I think that this is much more clear but I have now some doubts:
Is this true?
My reasoning is that the static keyword can only apply to an
object, and a typedef is not an object. (Obviously there is
another obscure meaning to "static". Let's leave that for now)
Another problem is that both msvc and gcc say something about
"multiple storage classes" that I can't understand. Why that?
Note too that lcc-win issues just a warning. The other two issue
an error and compilation fails. Is this such a bad error that
warrants a failure to compiler the code?
static typedef struct {
int boo;
} FOO;
This provokes with MSVC:
------------------------------
Microsoft (R) C/C++ Optimizing Compiler Version 14.00.50727.762 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
tstruct.c
tstruct.c(1) : error C2159: more than one storage class specified
------------------------------
With gcc we have:
----------------------------
root@ubuntu-vm:/tmp# gcc t.c
t.c:1: error: multiple storage classes in declaration specifiers
----------------------------
With lcc-win I had
Warning tstruct.c: 1 multiple types in a declaration. Last will be
used: 'typedef'
with lcc-win64
------------------------------
Warning tstruct.c: 1 multiple use of 'typedef'
------------------------------
All those warnings are misleading in my opinion. I have changed the
wording to:
Warning tstruct.c: 1 typedefs can't be static. Static keyword ignored
I think that this is much more clear but I have now some doubts:
Is this true?
My reasoning is that the static keyword can only apply to an
object, and a typedef is not an object. (Obviously there is
another obscure meaning to "static". Let's leave that for now)
Another problem is that both msvc and gcc say something about
"multiple storage classes" that I can't understand. Why that?
Note too that lcc-win issues just a warning. The other two issue
an error and compilation fails. Is this such a bad error that
warrants a failure to compiler the code?