C++ traps that D2 doesn't avoid yet?

Ary Borenszweig ary at esperanto.org.ar
Fri Nov 7 02:34:13 PST 2008


ore-sama escribió:
> bearophile Wrote:
> 
>> But what I've just said can't help you see why it's so important for the compiler to help avoid as many bugs as possible. I can't explain such essential concept in few lines here, so I suggest you to keep programming and reading, eventually you will probably get it.
>>
> it's clearly understandable that we don't need bugs. My point is to not let compiler prevent programmer from writing expressive code. If you force programmer to write a lot of text to make compiler happy, this in turn can cause bugs.

if(x);
   doSomething

Cool, you can express this: test something, and do nothing if true. Do 
you really need that expressiveness?

Another one: the Eclipse Java compiler would tell if you might get a 
NullPointerException since at the beginning of a method you assign some 
variable to null, then you might change it to something non-null in some 
path, but you might not realize that you didn't make sure to set it to 
something non-null in all paths. So there goes Eclipse and tells you: in 
this specific line, that variable might be null.

Do you want to be able to express "I probably have a bug here"?



More information about the Digitalmars-d mailing list