Topic: Prefixing member data with underscore (_)


Author: rfg@netcom.com (Ronald F. Guilmette)
Date: Fri, 17 Dec 1993 09:48:03 GMT
Raw View
In article <SRIRAM.93Dec10212121@stimpy.eecis.udel.edu> sriram@stimpy.eecis.udel.edu (Musiri Sriram) writes:
>In article <rfgCHpLz4.C1n@netcom.com> rfg@netcom.com (Ronald F. Guilmette) writes:
>
>[...]
>   To be more precise the current C++ standardization committee draft says
>   that "...identifiers containing double underscore are reserved for use
>   by C++ implementations (and standard libraries) and should be avoided
>   by users."  (See 2.8/3.)
>[...]
>   -- Ronald F. Guilmette, Sunnyvale, California -------------------------------
>   ------ domain address: rfg@netcom.com ---------------------------------------
>   ------ uucp address: ...!uunet!netcom.com!rfg -------------------------------
>
>
>  I have always understood this to mean that, if I used a name with a double
>underscore, I'm risking name conflicts; so I should avoid it. To get around
>this, I use _triple_ underscores. Is this also wrong?

Yes, but it's very humorous.

--

-- Ronald F. Guilmette, Sunnyvale, California -------------------------------
------ domain address: rfg@netcom.com ---------------------------------------
------ uucp address: ...!uunet!netcom.com!rfg -------------------------------




Author: sriram@stimpy.eecis.udel.edu (Musiri Sriram)
Date: 11 Dec 1993 02:21:21 GMT
Raw View
In article <rfgCHpLz4.C1n@netcom.com> rfg@netcom.com (Ronald F. Guilmette) writes:

[...]
   To be more precise the current C++ standardization committee draft says
   that "...identifiers containing double underscore are reserved for use
   by C++ implementations (and standard libraries) and should be avoided
   by users."  (See 2.8/3.)
[...]
   -- Ronald F. Guilmette, Sunnyvale, California -------------------------------
   ------ domain address: rfg@netcom.com ---------------------------------------
   ------ uucp address: ...!uunet!netcom.com!rfg -------------------------------


  I have always understood this to mean that, if I used a name with a double
underscore, I'm risking name conflicts; so I should avoid it. To get around
this, I use _triple_ underscores. Is this also wrong?

- Sriram
--
M.S.Sriram  I have heard the mermaids singing, each to each.
(sriram@cis.udel.edu)   I do not think that they will sing to me.
Dept of CIS,       - not Garp
University of Delaware Life is like a grapefruit. - adamsd@cerf.net






Author: grumpy@cbnewse.cb.att.com (Paul J Lucas)
Date: Sun, 12 Dec 1993 17:27:43 GMT
Raw View


Author: rfg@netcom.com (Ronald F. Guilmette)
Date: Wed, 8 Dec 1993 09:21:03 GMT
Raw View
In article <KANZE.93Nov25135228@slsvhdt.us-es.sel.de> kanze@us-es.sel.de (James Kanze) writes:
>In article <fC28sAJCBh107h@rcp.co.uk> alan@rcp.co.uk (Alan Stokes)
>writes:
>
>|> In <CGyLEp.3KK@cbnewse.cb.att.com> grumpy@cbnewse.cb.att.com (Paul J Lucas) writes:
>
>|> > ... you can not use identifier with two consecutive underscores
>|> > *ANYWHERE* in the identifier.
>
>|> Is this in the current draft of the standard?
>
>Yes.  Not only is it illegal to use two consecutive underscores, doing
>so is undefined behavior, and the implementation is not even required
>to diagnose an error.

To be more precise the current C++ standardization committee draft says
that "...identifiers containing double underscore are reserved for use
by C++ implementations (and standard libraries) and should be avoided
by users."  (See 2.8/3.)

I believe that the *intent* here is that any definition or declaration
of an identifier within a user's program should render that program
ill-formed.

Note however that one hopes that it is still permissible to *use* such
an identifier.  If it isn't, then a lot of people are going to be very
upset to learn that they will have to remove all of those tests for
the definition status of `__cplusplus' from their existing programs.

(Follow-ups to comp.std.c++ please.)

--

-- Ronald F. Guilmette, Sunnyvale, California -------------------------------
------ domain address: rfg@netcom.com ---------------------------------------
------ uucp address: ...!uunet!netcom.com!rfg -------------------------------