[DGD] boolean integers: mudos vs dgd

Kris Van Hees aedil at alchar.org
Mon Apr 22 01:14:43 CEST 2013


Heh, yes, that is my point...  Or rather, my posting was meant to indicate the
various issues involved that are underlying that decision.  So, sorry if I gave
the impression that I either did not know this or that I think it is wrong.  I
have and always will be a big supported of the standard on this and many other
issues related to the C language.

	Cheers,
	Kris

Sun, Apr 21, 2013 at 08:44:18AM -0700, Noah Gibbs wrote:
> Kris,
> 
> The standard defines and has always defined true as not-zero *on input*.  But logical and relational operators are required to return 1 or 0.  Since 1 is not zero, and thus true, that's a perfectly consistent way to do it.
> 
> I just went and looked it up after Dworkin's reply :-)
> 
> 
> ________________________________
>  From: Kris Van Hees <aedil at alchar.org>
> To: All about DGD and Hydra <dgd at dworkin.nl> 
> Sent: Sunday, April 21, 2013 8:04 AM
> Subject: Re: [DGD] boolean integers: mudos vs dgd
>  
> 
> I do not have the standard (and previous historical versions) at hand right
> now, but I believe there was a time where a truth value was defined as not-0,
> i.e. not false.  Under that interpretation a case could be made that a truth
> value can be anything that is not 0 (false).  However, there are certainly
> other implications that help drive a sensible value to be used.  For one, what
> would the !0 (negation of false) yield as value?  Why would 3 || 5 evaluate as
> 3 and not 99?  Given that || is a logical or-operator, it should yield a
> boolean (true/false) result, and that need not be defined as x || y being
> equivalent with (x ? x : (y ? y : 0)).  In fact, why would it be?  What would
> you define as the datatype of the result of the || operator?  In LPC it would
> need to be mixed, since you could do 3 || 5.6 or 5.4 || "string", etc...
> 
>     Kris
> 
> On Sun, Apr 21, 2013 at 07:52:01AM -0700, Noah Gibbs wrote:
> > I think it's actually undefined in C as well, according to standard.  But if it's undefined, 1 is a perfectly good answer.
> > 
> > 
> > ________________________________
> >  From: Felix A. Croes <felix at dworkin.nl>
> > To: dgd at dworkin.nl 
> > Sent: Sunday, April 21, 2013 4:11 AM
> > Subject: Re: [DGD] boolean integers: mudos vs dgd
>> > 
> > Raymond Jennings <shentino at gmail.com> wrote:
> > 
> > > 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.
> > 
> > It's 1 in C.  || evaluates to a boolean value.
> > 
> > 
> > > First of all, any major reason for the difference?
> > 
> > Who knows what the reason might be?  It's MudOS, not DGD, which has some
> > explaining to do.
> > 
> > Regards,
> > Felix Croes
> > ____________________________________________
> > https://mail.dworkin.nl/mailman/listinfo/dgd
> > ____________________________________________
> > https://mail.dworkin.nl/mailman/listinfo/dgd
> 
> -- 
> Never underestimate a Mage with:
> - the Intelligence to cast Magic Missile,
> - the Constitution to survive the first hit, and
> - the Dexterity to run fast enough to avoid being hit a second time.
> ____________________________________________
> https://mail.dworkin.nl/mailman/listinfo/dgd
> ____________________________________________
> https://mail.dworkin.nl/mailman/listinfo/dgd

-- 
Never underestimate a Mage with:
 - the Intelligence to cast Magic Missile,
 - the Constitution to survive the first hit, and
 - the Dexterity to run fast enough to avoid being hit a second time.



More information about the DGD mailing list