[cfe-dev] #define behavior
Hartmut Kaiser
hartmut.kaiser at gmail.com
Thu Dec 6 17:37:06 PST 2007
Neil,
> > > > Further, IIUC concatenating two tokens (using ##)
> forming another
> > > > (invalid) pp token results in undefined behaviour in
> C90/C++ but
> > > > is allowed in C99/C++09. Gcc issues a warning here (I'm not
> > > sure about clang) for C90/C++.
> > >
> > > There is no difference between C90 and C99 here. I'm the person
> > > that made it a hard error in GCC; it is not a warning.
> > > That is and was my preference. :)
> >
> > Ok, but it is allowed in C99, and undefined behaviour in C++98.
> > Admittedly, I was not sure about C90.
>
> I don't understand what you mean "is allowed". An
> implementation can choose to make undefined behaviour allowed
> in any particular case, but invalid pasting is not required
> to be accepted by any of the standards; it is undefined in
> all (or can you quote something to the contrary?)
I had to re-read both standards, and you're right. I'm sorry for the noise,
somehow I was thinking it's not undefined behaviour in C99.
> C++'s preprocessor is essentially C90's with a couple of tweaks
> for booleans and UCNs; nothing else changes.
Ok, good to know. I don't have a C90 standards document available.
Regards Hartmut
More information about the cfe-dev
mailing list