DMD 0.148 release

Russ Lewis spamhole-2001-07-16 at deming-os.org
Tue Mar 7 15:43:04 PST 2006


Walter Bright wrote:
> Lots of new stuff, I added new threads for them in the digitalmars.D 
> newsgroup.
> 
> http://www.digitalmars.com/d/changelog.html

FWIW, here's a(nother) practical example why bools-that-are-not-ints 
would be useful.  I hit this bug in my own, real-world code, *TODAY*.

I am writing a small compiler.  In it, I build parse trees and 
expression trees.  Some of these types had a field 'is_array'.  Today I 
decided that it would be better to store the array length instead, so I 
replaced 'is_array' with 'array_length in each struct.  I then had to 
modify all of the code that used those fields.

In a dozens of places I had tests like:
	if(expr->value.is_array)
which I needed to convert to
	if(expr->value.array_length > 0)

Yet, in a number of cases, I ended up doing, instead:
	if(expr->value.array_length);

Likewise, at least once I turned a test like
	if(!expr->value.is_array)
into
	if(!expr->value.array_length > 0)

Which are very hard to find...I'm just gradually finding these problems 
as I run my test suite on the program.  They would have been compile 
errors if bools and ints didn't have implicit casts between them.



More information about the Digitalmars-d-announce mailing list