[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: KDE/kdepim/kmail
From:       Ingo =?iso-8859-15?q?Kl=F6cker?= <kloecker () kde ! org>
Date:       2008-02-25 21:35:38
Message-ID: 200802252235.39351 () erwin ! ingo-kloecker ! de
[Download RAW message or body]


On Monday 25 February 2008, Thiago Macieira wrote:
> Ingo Klöcker wrote:
> >On Monday 25 February 2008, Thiago Macieira wrote:
> >> On Monday 25 February 2008 12:33:50 Marc Mutz wrote:
> >> > The trick is to use "T\xE2" "ches" to force the 2-bit
> >> > interpretation, or to use (untested) \x00E2.
> >>
> >> $ echo 'const char msg[] = "T\\x000000E2ches";' |
> >> g++ -fsyntax-only -xc++ /dev/stdin
> >> /dev/stdin:1: error: hex escape sequence out of range
> >
> >The C++ standard allows arbitrary long hex escape sequences (for
> >whatever unfathomable reason). Before committing I checked the C
> > ANSI standard and there hex escape sequences seem to be restricted
> > to a maximum of 2 hex chars. Obviously, that's no excuse for not
> > compiling before committing.
>
> $ echo 'const char str[] = "T\\x000000000000000E2ches";' |
> gcc-4.2.2 -c -xc -std=c89 /dev/stdin
> /dev/stdin:1:20: warning: hex escape sequence out of range
> $ strings stdin.o
> T,hes
>
> ANSI C doesn't like it either.

Hmm, either it was allowed in the 1983 standard or the small booklet I 
got the information from is wrong. Newer C standards do indeed allow 
arbitrary long hex escape sequences.

So, what did we learn from this thread? Do not trust a book that was 
written 25 years ago. :-)


Regards,
Ingo

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic