> From: Saifi Khan <[email protected]>
> Subject: [twincling] two C programs
> Sent: 10 Apr '09 04:21
>
> Hi all:
>
> What is the difference between the following two C programs ?
>
<< snipped >>
> All observations and insights are very welcome.
>
>
> thanks
> Saifi.
>
Ran both snippets on little endian and big endian machines.
In all (four) cases the results were the same.
Did you observe something different ?
Details:
(gdb) b main
Breakpoint 1 at 0x8048350: file hex-char.c, line 5.
(gdb) r
Starting program: ~niyer/trials/hex-char
Breakpoint 1, main (argc=1, argv=0xbfe72a34) at hex-char.c:5
5 unsigned char uc[] = "\xFF";
(gdb) n
6 return 0;
(gdb) p uc
$1 = "ÿ"
(gdb) p /x uc
$2 = {0xff, 0x0}
---
(gdb) b main
Breakpoint 1 at 0x8048350: file hex-char.c, line 16.
(gdb) r
Starting program: ~niyer/trials/hex-char
Breakpoint 1, main (argc=1, argv=0xbff2ccd4) at hex-char.c:16
16 unsigned char uc[2] = { (unsigned char)(char) 0xFF, 0 };
(gdb) n
18 return 0;
(gdb) p uc
$1 = "ÿ"
(gdb) p /x uc
$2 = {0xff, 0x0}
(gdb)