Re: >>/<< 32 Bit wrong on 32 architechture

From: Benjamin Riefenstahl (Benjamin.Riefenstahl_at_epost.de)
Date: 12/31/03


Date: Wed, 31 Dec 2003 19:03:46 +0100

Hi Gerhard,

Gerhard Hintermayer <g.hintermayer@inode.at> writes:
> Well, I was wondering, why "undefined" is obviously implemented as
> "sometimes correct" and "sometimes not".

My understanding is that math expressions in C were supposed to be
implemented in just one assembly instruction each, give or take some
register juggling (C is sometimes defined as "a portable assembler").
So error checks or preconditions were not wanted, instead some
variation was allowed. With those variations, the outcome even often
depends on compiler optimization flags.

> Do you think, that this "undefined" is useful ?

In C, primarily it just is as it is. Even if you were to lobby for a
change in the C language now, portable code would have to wait for the
spec to change and than maybe some 10 years more, until compilers on
all reasonably platforms have the change.

> we would have an implemetation of expr in tcl, which could handle
> this

Tcl doesn't have those constraints, so it can be more precise.

> instead of saying: but look, C can't handle that either.

IIRC, Tcl just took the whole math expression language from C and
said, "we just use what you already know from C with the same
semantics." That made definition and implementation very simple.

benny



Relevant Pages

  • Re: >>/<< 32 Bit wrong on 32 architechture
    ... >> In C89 the result of ... g.hintermayer@inode.at (Gerhard Hintermayer) writes: ... Of course in Tcl, we can do whatever we want. ... so speed-oriented when compared to C math expressions. ...
    (comp.lang.tcl)
  • Re: >>/<< 32 Bit wrong on 32 architechture
    ... > Hi Gerhard, ... >>Regardless what C89 Standard says, this is quite an unusable result, ... > Of course in Tcl, we can do whatever we want. ... > so speed-oriented when compared to C math expressions. ...
    (comp.lang.tcl)