public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/43352] New: keyword 'and' defined when even in the absence of iso646
@ 2010-03-13 3:54 mdjones0978-gcc at yahoo dot com
2010-03-13 3:58 ` [Bug c++/43352] " mdjones0978-gcc at yahoo dot com
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: mdjones0978-gcc at yahoo dot com @ 2010-03-13 3:54 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 940 bytes --]
========= 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
--
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/43352] keyword 'and' defined when even in the absence of iso646
2010-03-13 3:54 [Bug c++/43352] New: keyword 'and' defined when even in the absence of iso646 mdjones0978-gcc at yahoo dot com
@ 2010-03-13 3:58 ` mdjones0978-gcc at yahoo dot com
2010-03-13 3:59 ` pinskia at gmail dot com
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: mdjones0978-gcc at yahoo dot com @ 2010-03-13 3:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from mdjones0978-gcc at yahoo dot com 2010-03-13 03:58 -------
Created an attachment (id=20098)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20098&action=view)
Example code
compile with
g++ test.cpp
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43352
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Bug c++/43352] New: keyword 'and' defined when even in the absence of iso646
2010-03-13 3:54 [Bug c++/43352] New: keyword 'and' defined when even in the absence of iso646 mdjones0978-gcc at yahoo dot com
` (2 preceding siblings ...)
2010-03-13 3:59 ` mdjones0978-gcc at yahoo dot com
@ 2010-03-13 3:59 ` Andrew Pinski
2010-03-13 4:37 ` [Bug c++/43352] " pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: Andrew Pinski @ 2010-03-13 3:59 UTC (permalink / raw)
To: gcc-bugzilla; +Cc: gcc-bugs
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
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/43352] keyword 'and' defined when even in the absence of iso646
2010-03-13 3:54 [Bug c++/43352] New: keyword 'and' defined when even in the absence of iso646 mdjones0978-gcc at yahoo dot com
2010-03-13 3:58 ` [Bug c++/43352] " mdjones0978-gcc at yahoo dot com
2010-03-13 3:59 ` pinskia at gmail dot com
@ 2010-03-13 3:59 ` mdjones0978-gcc at yahoo dot com
2010-03-13 3:59 ` [Bug c++/43352] New: " Andrew Pinski
2010-03-13 4:37 ` [Bug c++/43352] " pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: mdjones0978-gcc at yahoo dot com @ 2010-03-13 3:59 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from mdjones0978-gcc at yahoo dot com 2010-03-13 03:59 -------
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
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43352
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/43352] keyword 'and' defined when even in the absence of iso646
2010-03-13 3:54 [Bug c++/43352] New: keyword 'and' defined when even in the absence of iso646 mdjones0978-gcc at yahoo dot com
2010-03-13 3:58 ` [Bug c++/43352] " mdjones0978-gcc at yahoo dot com
@ 2010-03-13 3:59 ` pinskia at gmail dot com
2010-03-13 3:59 ` mdjones0978-gcc at yahoo dot com
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gmail dot com @ 2010-03-13 3:59 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1460 bytes --]
------- Comment #2 from pinskia at gmail dot com 2010-03-13 03:59 -------
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
>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43352
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/43352] keyword 'and' defined when even in the absence of iso646
2010-03-13 3:54 [Bug c++/43352] New: keyword 'and' defined when even in the absence of iso646 mdjones0978-gcc at yahoo dot com
` (3 preceding siblings ...)
2010-03-13 3:59 ` [Bug c++/43352] New: " Andrew Pinski
@ 2010-03-13 4:37 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-03-13 4:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2010-03-13 04:37 -------
Use -fno-operator-names if you want these keywords not to be keywords in C++.
Closing as invalid because these are keywords in C++.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43352
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-03-13 4:37 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-13 3:54 [Bug c++/43352] New: keyword 'and' defined when even in the absence of iso646 mdjones0978-gcc at yahoo dot com
2010-03-13 3:58 ` [Bug c++/43352] " mdjones0978-gcc at yahoo dot com
2010-03-13 3:59 ` pinskia at gmail dot com
2010-03-13 3:59 ` mdjones0978-gcc at yahoo dot com
2010-03-13 3:59 ` [Bug c++/43352] New: " Andrew Pinski
2010-03-13 4:37 ` [Bug c++/43352] " pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).