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)


Quoting Ian Lance Taylor <iant@google.com>:

Joern Rennecke <amylaar@spamcop.net> writes:
...   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

Yes, that is certainly the way to go if it is in fact not safe to use "extern const int i = 1;" for all C compilers. I hadn't planned to deal with this issue yet, but since you bring it up, we should decide whether that construct is safe, or whether we need the macro.

I think it would also be a better interim solution, since it is easier to code, easier to switch experimentally, and easier to globally replace with extern const if we decide that that is safe for all the C bootstrap compilers we care about.


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