Re: 0xdeadbeef vs 0xdeadbeefL
From: Horst von Brand (vonbrand_at_inf.utfsm.cl)
Date: 07/08/04
- Previous message: Michael Driscoll: "Re: [OT] Re: 0xdeadbeef vs 0xdeadbeefL"
- Maybe in reply to: David Eger: "0xdeadbeef vs 0xdeadbeefL"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: tom st denis <tomstdenis@yahoo.com> Date: Thu, 08 Jul 2004 13:16:25 -0400
tom st denis <tomstdenis@yahoo.com> said:
> --- Gabriel Paubert <paubert@iram.es> wrote:
[...]
> > On many platforms a "plain" char is unsigned. You can't write
> > portable
> > code without knowing this.
>
> Um, actually "char" like "int" and "long" in C99 is signed.
Nope. char is either an unsigned char or a signed char, which one is up to
the implementation, and the three types are distinct. The signed keyword
was introduced exactly for the corner case of an explicitly signed (not
unsigned, and not maybe signed) char.
> So while
> you can write
>
> signed int x = -3;
>
> You don't have to. in fact if you "have" to then your compiler is
> broken. Now I know that GCC offers "unsigned chars" but that's an
> EXTENSION not part of the actual standard.
Not an extension, in C for ever and ever.
> You ought to distinguish "what my compiler does" with "what the
> standard actually says". If you want unsigned chars don't be lazy,
> just write "unsigned char".
Right. Look at the standard, and then go back and rewrite to agree with C99
all the "standard conforming" C you have written. Should keep you away from
LKML for a while...
-- Dr. Horst H. von Brand User #22616 counter.li.org Departamento de Informatica Fono: +56 32 654431 Universidad Tecnica Federico Santa Maria +56 32 654239 Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Previous message: Michael Driscoll: "Re: [OT] Re: 0xdeadbeef vs 0xdeadbeefL"
- Maybe in reply to: David Eger: "0xdeadbeef vs 0xdeadbeefL"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|