avr-gcc-list
[Top][All Lists]
Advanced

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

RE: [avr-gcc-list] Re: Strings: escape sequence to insert arbitrary hex


From: Dave Hansen
Subject: RE: [avr-gcc-list] Re: Strings: escape sequence to insert arbitrary hex value ?
Date: Thu, 5 Feb 2009 12:04:31 -0500



 From: address@hidden
> On Thu, Feb 05, 2009 at 12:13:37AM -0700, Chris Kuethe wrote:
>> On Thu, Feb 5, 2009 at 12:10 AM, Schwichtenberg, Knut
>>  wrote:
>>> As far as I know hex values won't work as expected but octal does!
>>>
>>> I used:
>>>
>>> static char s46[] __attribute__ ((progmem)) = "Hei\342gas"; /* 46 */
>>>
>>> which is written as "Hei?gas" on an LCD.
>> 
>> As far as I know, hex values do work... because I tried that program
>> before pasting it. But some people prefer octal escapes...
> 
> Odds are that is an avr-gcc patch and not standard gcc. Am more certain
> the support of entering binary values is an avr-gcc enhancement because
> I see the patch file in the FreeBSD port.

ISO C99, section 6.4.4.4, p3:
The single-quote ', the double-quote ", the question-mark ?, the backslash \, 
and
arbitrary integer values are representable according to the following table of 
escape
sequences:
single quote' \'
double quote" \"
question mark? \?
backslash\ \\
octal character \octal digits
hexadecimal character \x hexadecimal digits
 
Same section, p6:
The hexadecimal digits that follow the backslash and the letter x in a 
hexadecimal escape
sequence are taken to be part of the construction of a single character for an 
integer
character constant or of a single wide character for a wide character constant. 
The
numerical value of the hexadecimal integer so formed specifies the value of the 
desired
character or wide character.
 
Regards,
 
   -=Dave
 
_________________________________________________________________
Windows Liveā„¢: E-mail. Chat. Share. Get more ways to connect. 
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t2_allup_explore_022009



reply via email to

[Prev in Thread] Current Thread [Next in Thread]