========= test.cpp ========== #include <string> std::string and(" AND "); #ifdef and #undef and #endif #define and ======== error msgs ============= test.cpp:5:8: error: "and" cannot be used as a macro name as it is an operator in C++ test.cpp:8:9: error: "and" cannot be used as a macro name as it is an operator in C++ test.cpp:3: error: expected unqualified-id before â&&â token Several comments along this theme. http://stackoverflow.com/questions/2419805/when-did-and-become-an-operator-in-c http://en.wikipedia.org/wiki/Iso646.h
Created attachment 20098 [details] Example code compile with g++ test.cpp
Subject: Re: New: keyword 'and' defined when even in the absence of iso646 Sent from my iPhone On Mar 12, 2010, at 7:54 PM, "mdjones0978-gcc at yahoo dot com" <gcc-bugzilla@gcc.gnu.org > wrote: > ========= test.cpp ========== > #include <string> > > std::string and(" AND "); > > #ifdef and > #undef and > #endif > #define and > > ======== error msgs ============= > test.cpp:5:8: error: "and" cannot be used as a macro name as it is > an operator > in C++ > test.cpp:8:9: error: "and" cannot be used as a macro name as it is > an operator > in C++ > test.cpp:3: error: expected unqualified-id before â&&â token > > > Several comments along this theme. > http://stackoverflow.com/questions/2419805/when-did-and-become-an-operator-in-c > http://en.wikipedia.org/wiki/Iso646.h > C++ is not C. The C++ standard says these are keywords and not defines which is unlike the C standard. > > -- > Summary: keyword 'and' defined when even in the absence of > iso646 > Product: gcc > Version: 4.4.1 > Status: UNCONFIRMED > Severity: minor > Priority: P3 > Component: c++ > AssignedTo: unassigned at gcc dot gnu dot org > ReportedBy: mdjones0978-gcc at yahoo dot com > > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43352 >
g++ (Ubuntu 4.4.1-4ubuntu9) 4.4.1 Linux 2.6.31-20-generic #57-Ubuntu SMP Mon Feb 8 09:05:19 UTC 2010 i686 GNU/Linux
Use -fno-operator-names if you want these keywords not to be keywords in C++. Closing as invalid because these are keywords in C++.