This is the mail archive of the gcc@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: extern const (Was: Re: [gcc-in-cxx]: patches from multi-target-4_4-branch)


On Sun, May 24, 2009 at 10:23 PM, Joern Rennecke <amylaar@spamcop.net> wrote:
> Quoting Ian Lance Taylor <iant@google.com>:
>>
>> Joern Rennecke <amylaar@spamcop.net> writes:
>>>
>>> ? ? ? ?* config/sh/sh.c (sh_attribute_table): Use extern in forward
>>> ? ? ? ?declaration.
>>> Common issue with declaring/defining const variables in C++.
>>
>> I've been doing this as
>>
>> #ifdef __cplusplus
>> extern
>> #endif
>
> These #ifdefs sprinkled over the code are awkward. ?Could we use a #define
> for this? ?E.g. put in system.h
> #ifdef __cplusplus
> #define CONST_VAR_DECL extern const
> #else
> #define CONST_VAR_DECL const
> #endif

It is much better than defining 'extern' to nothing.

I'm a bit surprised that a C90 compiler will not accept
'extern const'.

>


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