public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* __op ? with gcc/egcs
@ 1998-06-23 14:01 Alain Magloire
  1998-06-23 19:23 ` Joe Buck
  1998-06-23 22:55 ` Martin von Loewis
  0 siblings, 2 replies; 6+ messages in thread
From: Alain Magloire @ 1998-06-23 14:01 UTC (permalink / raw)
  To: egcs

Bonjour

  Did I missed something obvious ?
  Is ``__op'', a reserved word with egcs/g++ ?

g++ bar.c
bar.c:3: declaration of `operator ' as non-function
bar.c:3: confused by earlier errors, bailing out

cat -n bar.c
     1  int
     2  foo (int __op)
     3  { return __op; }
     4
     5  int
     6  main ()
     7  { foo (1); return 0; }


Thanks for all the great work.

-- 
au revoir, alain
----
Aussi haut que l'on soit assis, on n'est toujours assis que sur son cul !!!


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: __op ? with gcc/egcs
  1998-06-23 14:01 __op ? with gcc/egcs Alain Magloire
@ 1998-06-23 19:23 ` Joe Buck
  1998-06-23 22:55 ` Martin von Loewis
  1 sibling, 0 replies; 6+ messages in thread
From: Joe Buck @ 1998-06-23 19:23 UTC (permalink / raw)
  To: Alain Magloire; +Cc: egcs

>   Did I missed something obvious ?
>   Is ``__op'', a reserved word with egcs/g++ ?

*All* identifiers with two leading underscores are reserved to the
implementation, for any C or C++ compiler.  If you use any such names
and you aren't writing the standard C or C++ library, you're violating
the standard.  So don't do that!

g++ uses some names of this form for overloaded operators.  I'm not
sure what __op is.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: __op ? with gcc/egcs
  1998-06-23 14:01 __op ? with gcc/egcs Alain Magloire
  1998-06-23 19:23 ` Joe Buck
@ 1998-06-23 22:55 ` Martin von Loewis
  1998-06-25  3:09   ` Gabriel Dos Reis
  1 sibling, 1 reply; 6+ messages in thread
From: Martin von Loewis @ 1998-06-23 22:55 UTC (permalink / raw)
  To: alain; +Cc: egcs

>   Did I missed something obvious ?

The obvious thing you miss that all names starting with two underscores,
or with one underscore followed by an uppercase letter, are reserved for
the implementation (i.e. compiler/libraries).

>   Is ``__op'', a reserved word with egcs/g++ ?

The not-so-obvious thing is that g++ indeed reserves __op, and a
number of other names, to represent operator functions internally.
For example, you get a similar message with __pl.

I'm sure this restriction can be removed. I'm not so sure whether it
is worth the effort.

Hope this helps,
Martin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: __op ? with gcc/egcs
  1998-06-23 22:55 ` Martin von Loewis
@ 1998-06-25  3:09   ` Gabriel Dos Reis
  0 siblings, 0 replies; 6+ messages in thread
From: Gabriel Dos Reis @ 1998-06-25  3:09 UTC (permalink / raw)
  To: egcs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 808 bytes --]

>>>>> «Martin», Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de> wrote:

>> Did I missed something obvious ?
Martin> The obvious thing you miss that all names starting with two underscores,
Martin> or with one underscore followed by an uppercase letter, are reserved for
Martin> the implementation (i.e. compiler/libraries).

>> Is ``__op'', a reserved word with egcs/g++ ?

Martin> The not-so-obvious thing is that g++ indeed reserves __op, and a
Martin> number of other names, to represent operator functions internally.
Martin> For example, you get a similar message with __pl.

Martin> I'm sure this restriction can be removed. I'm not so sure whether it
Martin> is worth the effort.

	
The standard is perfectly clear about reserved names and identifiers
beginning with underscores. 

-- Gaby

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: __op ? with gcc/egcs
       [not found] <199806232101.RAA03930.cygnus.egcs@qnx.com>
@ 1998-06-23 16:21 ` Ulrich Drepper
  0 siblings, 0 replies; 6+ messages in thread
From: Ulrich Drepper @ 1998-06-23 16:21 UTC (permalink / raw)
  To: egcs

alain@qnx.com (Alain Magloire) writes:

> Bonjour
> 
>   Did I missed something obvious ?
>   Is ``__op'', a reserved word with egcs/g++ ?

Yes.

-- 
---------------.      drepper at gnu.org  ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com   `------------------------

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: __op ? with gcc/egcs
@ 1998-06-23 16:21 Mike Stump
  0 siblings, 0 replies; 6+ messages in thread
From: Mike Stump @ 1998-06-23 16:21 UTC (permalink / raw)
  To: alain, egcs

> To: egcs@cygnus.com
> Date: Tue, 23 Jun 1998 17:00:54 -0400 (EDT)
> From: "Alain Magloire" <alain@qnx.com>

>   Did I missed something obvious ?

Yes.

>   Is ``__op'', a reserved word with egcs/g++ ?

From the C++ language standard:

2 In addition, identifiers containing  a  double  underscore  (  __)  or
  beginning with an underscore and an upper-case letter are reserved for
  use by C++ implementations and standard libraries  and  shall  not  be
  used otherwise; no diagnostic is required.

Don't do that.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1998-06-25  3:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-06-23 14:01 __op ? with gcc/egcs Alain Magloire
1998-06-23 19:23 ` Joe Buck
1998-06-23 22:55 ` Martin von Loewis
1998-06-25  3:09   ` Gabriel Dos Reis
1998-06-23 16:21 Mike Stump
     [not found] <199806232101.RAA03930.cygnus.egcs@qnx.com>
1998-06-23 16:21 ` Ulrich Drepper

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).