[DGD] boolean integers: mudos vs dgd

Kris Van Hees aedil at alchar.org
Sun Apr 21 17:04:52 CEST 2013


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.



More information about the DGD mailing list