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

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

 



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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux