[DGD] boolean integers: mudos vs dgd

Noah Gibbs noah_gibbs at yahoo.com
Mon Apr 22 04:03:49 CEST 2013


Actually, that's what Felix was disagreeing with.  Returning numbers other than 1 or 0 is *not* allowed by the current standard.  What standard are you thinking of where it was allowed?

I'm not disagreeing, I just don't have an older standard to hand, and Felix is right with the current one.


________________________________
 From: Jared Maddox <absinthdraco at gmail.com>
To: dgd at dworkin.nl 
Sent: Sunday, April 21, 2013 4:50 PM
Subject: Re: [DGD] boolean integers: mudos vs dgd
 

> Date: Sun, 21 Apr 2013 01:07:28 -0700
> From: Raymond Jennings <shentino at gmail.com>
> To: "All about Dworkin's Game Driver" <dgd at dworkin.nl>
> Subject: [DGD] boolean integers: mudos vs dgd
> Message-ID:
>     <CAGDaZ_rmphQzYe0pJZ45okvYZ_aakErjipfn==NV1YzF6u8ojQ at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> A friend of mine (blain) reports that the expression (5 || 3) returns 5,
> and the expression (3 || 5) returns 3, whereas dgd returns 1 for both of
> them.
>
> First of all, any major reason for the difference?
>
> Secondly, is treating an integer as a boolean value in this way stepping on
> undefined or implementation defined behavior either in LPC or regular C?
>

To go back to the (at least older) C standard, in that situation,
returning 1, 3, 5, 127, or any other positive in-bounds number is
perfectly acceptable. Counting on 3, or 5, or 1, or any other specific
value is dangerous, because it relies upon implementation-defined
behavior. The exact value of the return value is undefined, but the
generalities are defined, thus the exact value is
implementation-defined.
____________________________________________
https://mail.dworkin.nl/mailman/listinfo/dgd


More information about the DGD mailing list