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]

Re: keywords for operators (eg: and for &&) etc



> I'm getting a little confused about the ability to use keywords such as
> "and" for "&&" and so on.

It's not the default because there are a number of platforms where these
keywords appear in headers, and not all of them are cleaned up.

> g++ lets me use it in c++ code if I turn on -ansi which is listed as a C
> option. Yet ciso646 defines these keywords using macros only if __cplusplus
> is not set.

No, -ansi is both a C and a C++ option; basically it means "comply more
closely with standards".  It has the effect of turning off certain GNU
extensions, and turning on features that may conflict with backward
compatibility.

(Thanks for pointing out a bug in the manual, which describes -ansi as
only a C option).

> Ideally I would like to enable the keywords in C++ but I may wish to use
> features which cause problems with -ansi (long long has recently been
> mentioned as problematic). Can anyone tell me what my mistake is ?

-ansi will not reject programs that use extensions if those programs
can't be valid ANSI (ISO) C or C++, so it accepts "long long".  The
-pedantic flag will reject "long long".

But you can use the flag -foperator-names to turn on the operator names
but not change anything else.


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