This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc gets in the way of writing C that is also C++ wrt const


Jay K wrote:
> I was pointed to:
>  
> http://david.tribble.com/text/cdiffs.htm#C99-const-linkage
>  
>  
> which recommends exactly what I'd like to do:
>  
>  
>>> The recommended practice is therefore to define constants with an explicit static or extern specifier
>  
>  
> C:\>type 1.c
> extern const int b = 1;
>  
>  
> C:\>gcc -c 1.c
> 1.c:1: warning: `b' initialized and declared `extern'
> 
>  
> Why the warning?

Because it doesn't make much sense for C.

Try -Wc++-compat

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]