Re: >>/<< 32 Bit wrong on 32 architechture
From: Benjamin Riefenstahl (Benjamin.Riefenstahl_at_epost.de)
Date: 12/30/03
- Next message: Oliver Bienert: "Re: wikit local mode (change of help button)"
- Previous message: Cameron Laird: "Re: Capturing Maximize/Minimize events of Toplevel"
- In reply to: Gerhard Hintermayer: "Re: >>/<< 32 Bit wrong on 32 architechture"
- Next in thread: Gerhard Hintermayer: "Re: >>/<< 32 Bit wrong on 32 architechture"
- Reply: Gerhard Hintermayer: "Re: >>/<< 32 Bit wrong on 32 architechture"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 30 Dec 2003 13:30:31 +0100
Hi Gerhard,
> Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de> wrote in message
>> In C89 the result of
>>
>> a << b and a >> b
>>
>> is explicitly undefined if
>>
>> b >= (CHAR_BITS * sizeof(a)) || b < 0
g.hintermayer@inode.at (Gerhard Hintermayer) writes:
> ... but interesting, that
>
> printf("%d\n", 5<<32);
>
> does print zero (linux, gcc 3.2).
It could print 12345 and would still be correct according to the C
language rules. When the standard says "undefined", the compiler can
do anything. Or maybe I don't understand what you mean here.
> Regardless what C89 Standard says, this is quite an unusable result,
If you want some other result, you just need to write some other
expression, at least in C.
> So if compilers cannot handle this, should this be checked in
> tclExecute ?
Of course in Tcl, we can do whatever we want. Also Tcl is not quite
so speed-oriented when compared to C math expressions. So yes, we
could do that. Do you want to write a TIP?
benny
- Next message: Oliver Bienert: "Re: wikit local mode (change of help button)"
- Previous message: Cameron Laird: "Re: Capturing Maximize/Minimize events of Toplevel"
- In reply to: Gerhard Hintermayer: "Re: >>/<< 32 Bit wrong on 32 architechture"
- Next in thread: Gerhard Hintermayer: "Re: >>/<< 32 Bit wrong on 32 architechture"
- Reply: Gerhard Hintermayer: "Re: >>/<< 32 Bit wrong on 32 architechture"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]