C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Defect Report: "string-literal" used where narrow string lit

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards
View previous topic :: View next topic  
Author Message
Gennaro Prota
Guest





PostPosted: Wed Sep 13, 2006 4:35 am    Post subject: Defect Report: "string-literal" used where narrow string lit Reply with quote



There are several places in the standard where a string-literal is
said to be required but it is at best dubious whether a wide string
literal is actually allowed:

* 7 [dcl.dcl]/1 and 7 [dcl.dcl]/4: respectively grammar and
description for static_assert-declaration

* 7.4 [dcl.asm]/1: the asm declaration

* 7.5 [dcl.link]/1: linkage specifications

* 8.5.2 [dcl.init.string]/1:

"A char array (whether plain char, signed char, or unsigned char)
can be initialized by a string-literal (optionally enclosed in
braces)"

This should clearly be "A char array (whether plain char, signed
char, or unsigned char) can be initialized by a narrow
string-literal"

* 16.3.2 [cpp.stringize]/2:

"If, in the replacement list, a parameter is immediately preceded
by a # preprocessing token, both are replaced by a single
character string literal preprocessing token that contains the
spelling of the preprocessing token sequence for the
corresponding argument."

16.4 [cpp.line]/1:

"The string literal of a #line directive, if present, shall be a
character string literal."

This seems a terminology problem: does "character string literal"
stand for "narrow string literal"? Also, I can see an almost
random switching between the forms "string-literal", which a
hyphen, and "string literal". Maybe some editorial fix is in
order.

16.8 [cpp.predefined]/1:

"__FILE__
The presumed name of the source file (a character string
literal).

These three preprocessing cases should IMHO all be clarified.

--
Gennaro Prota

---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Back to top
Frederick Gotham
Guest





PostPosted: Wed Sep 13, 2006 7:45 am    Post subject: Re: Defect Report: "string-literal" used where narrow string Reply with quote



Gennaro Prota posted:

Quote:
There are several places in the standard where a string-literal is
said to be required but it is at best dubious whether a wide string
literal is actually allowed:


Perhaps it would be more convenient to write:

Unless explicitly described as a wide string literal, any mention of a
string literal in this International Standard refers to a narrow string
literal.

--

Frederick Gotham

---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Back to top
Greg Herlihy
Guest





PostPosted: Wed Sep 13, 2006 1:39 pm    Post subject: Re: Defect Report: "string-literal" used where narrow string Reply with quote



Frederick Gotham wrote:
Quote:
Gennaro Prota posted:

There are several places in the standard where a string-literal is
said to be required but it is at best dubious whether a wide string
literal is actually allowed:


Perhaps it would be more convenient to write:

Unless explicitly described as a wide string literal, any mention of a
string literal in this International Standard refers to a narrow string
literal.

Narrow string literals are also called "ordinary" string literals -
which means that the plain term "string literal" can be taken to mean a
narrow string literal.

Now the term "string-literal" (note the hyphen) is a specific
production of the C++ grammar (which is why the term is italicized).
Furthermore, the "string-literal" production encompasses both narrow
and wide string literals. So it is not the case that the Standard is
randomly varying the spelling of "string literal" because it is unsure
which variation is correct. On the contrary, the two terms are distinct
- one is a generic term for a program's constant character data and the
other is a specific production of the C++ language.

Greg

---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Back to top
Gennaro Prota
Guest





PostPosted: Wed Sep 13, 2006 5:39 pm    Post subject: Re: Defect Report: "string-literal" used where narrow string Reply with quote

On Wed, 13 Sep 2006 02:45:11 GMT, fgothamNO (AT) SPAM (DOT) com (Frederick
Gotham) wrote:

Quote:
Gennaro Prota posted:

There are several places in the standard where a string-literal is
said to be required but it is at best dubious whether a wide string
literal is actually allowed:


Perhaps it would be more convenient to write:

Unless explicitly described as a wide string literal, any mention of a
string literal in this International Standard refers to a narrow string
literal.

Hmm... in general I don't like these sorts of sentences: they are
almost always too far from any point they refer to, for little benefit
(the standard, just like source code, is read a considerable higher
number of times than it is written :-O).

<meta (to mods)>

A while ago defect report posts which were accepted by the
moderator carried a note along the lines of "forwarded to
the C++ committee". I notice this is no more the case. Are
they silently forwarded? (Last time this happened I verified
that it had *not* been forwarded)

</meta>

--
Gennaro Prota

---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.