Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/lib/libutil

On Wed, Aug 07, 2013 at 16:17:01 -0700, Paul Goyette wrote:

> >Module Name:    src
> >Committed By:   pgoyette
> >Date:           Wed Aug  7 22:51:59 UTC 2013
> >
> >Modified Files:
> >        src/lib/libutil: snprintb.3
> >
> >Log Message:
> >Add an example using snprintb_m()
> >
> >Replace \*[Gt] and \*[Lt] with the simple characters > and < (OK wiz)
> >
> >XXX Note that the examples currently do not compile with GCC!  The hex
> >XXX character sequences such as \x10CACHE are being parsed as longer
> >XXX than 2-hex-digit strings!
> Ah, this is gcc bug # 33167
> I will update the example code shortly in the manner specified in the bug 
> audit trail.

This is not a bug, as the audit trail mentions.  Relevant passages
from the standard follow:  Character constants

       [#14] EXAMPLE 3 Even if eight bits are used for objects that
       have  type  char,  the  construction  '\x123'  specifies  an
       integer  character  constant  containing only one character,
       since a hexadecimal escape sequence is terminated only by  a
       non-hexadecimal  character. ...

       6.4.5  String literals

       [#3]  The  same  considerations apply to each element of the
       sequence in a character string  literal  or  a  wide  string
       literal  as if it were in an integer character constant or a
       wide character constant, ...

       [#7]   EXAMPLE  This   pair  of  adjacent  character  string

               "\x12" "3"

       produces a single character string  literal  containing  the
       two  characters  whose  values  are  '\x12' and '3', because
       escape sequences are converted into single  members  of  the
       execution  character  set  just  prior  to  adjacent  string
       literal concatenation.

Adding a caveat to the man page about being careful with \x might be a
good idea.


Home | Main Index | Thread Index | Old Index