foralex / picoc

Automatically exported from code.google.com/p/picoc
0 stars 0 forks source link

typedef redefinition #128

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I'm not sure if this is included in any C standard, but some C compilers allow 
typedef redefinitions within the same scope as follows in the example:

typedef int bool;
typedef int bool;

In picoc this ends with error: 'bool' is already defined.

Original issue reported on code.google.com by belli...@asiotec.org on 19 Feb 2011 at 9:27

GoogleCodeExporter commented 8 years ago
Thanks for the suggestion.

I've checked and this seems to be disallowed by most compilers - eg. current 
gcc reports an error. Offhand this seems like it should be an error to me too, 
so I'm going to call the current behaviour correct.

Original comment by zik.sale...@gmail.com on 21 Feb 2011 at 12:35

GoogleCodeExporter commented 8 years ago
MSVC is not reporting any error to me

Original comment by belli...@asiotec.org on 21 Feb 2011 at 7:47

GoogleCodeExporter commented 8 years ago
What is more, You have defined bool type in picoC which is not available in C, 
right?
AFAIK it was introduced in C++. So if PicoC is C Interpreter it should not have 
bool type, or should has implemented typedef redifinition. Why? If someone 
wants to use bool type he probably defines it himself and then he gets error, 
since it's already defined in PicoC.

Original comment by belli...@asiotec.org on 7 Mar 2011 at 10:14