Re: std::vector crash

From: Kevin Lynch <krlynch_at_bu.edu>
Date: Fri, 17 Aug 2007 18:18:27 +0200


Christian Holm Christensen wrote:

>> Totally independent remark:
>> type names should not start with an underscore in C(++). 

>
> Why not?! A valid identifier in C/C++ has the following form
>
> [_a-zA-Z][_a-zA-Z0-9]*
>
> That is, a letter or an underscore, follow by zero or more letters,
> numbers, or underscores. You can even use UTF encoded identifiers if
> you like - the standard, I believe, is quite explicit about that.
>

While not debating the accuracy of your regex, ISO 14882-2003 says:

2.10 Identifiers [lex.name]
2 In addition, some identifiers are reserved for use by C++ implementations and standard libraries (17.4.3.1.2) and shall not be used otherwise; no diagnostic is required.

and

17.4.3.1.2 Global names [lib.global.names] Certain sets of names and function signatures are always reserved to the implementation:
— Each name that contains a double underscore (_ _) or begins with an underscore followed by an uppercase
letter (2.11) is reserved to the implementation for any use. — Each name that begins with an underscore is reserved to the implementation for use as a name in the
global namespace.165)

  1. Such names are also reserved in namespace ::std (17.4.3.1).
-- 
-------------------------------------------------------------------------------
Kevin Lynch				voice:	(617) 353-6025
Physics Department			Fax: (617) 353-9393
Boston University			office:	 PRB-361
590 Commonwealth Ave.			e-mail:	 krlynch_at_bu.edu
Boston, MA 02215 USA			http://budoe.bu.edu/~krlynch
-------------------------------------------------------------------------------
Received on Fri Aug 17 2007 - 18:18:29 CEST

This archive was generated by hypermail 2.2.0 : Fri Aug 17 2007 - 23:50:02 CEST