Last update December 10, 2006

Doc Comments /
Warnings



Difference (last change) (no other diffs, normal page display)

Deleted: 1,12d0
== More Information =


== Examples =


== Layout =

This page is still in the old style. And it isn't on the navigation column of any section. -- StewartGordon

I don't remember that it's ever been on the navigation column (though there is a link on DigitalMars:d/dcompiler.html), but adding it to the column sounds like a good idea to me. -- JustinCalvarese


Added: 16a5,6
=== Assertions are turned off in release mode ===


Deleted: 40,41d29
== Amendments =
Please also link this page to the DocumentationAmendments page when you make a change here.

Messages

Put your comments about the official/non-official page here.

Assertions are turned off in release mode

 A better solution is to make explicit what the D language does implicitly - put an assert there:

int foo(int k, Collection c) { foreach (int x; c) { if (x == k) return x + 1; } assert(0); }

Now, if the foreach does fall through, the error will be detected. Furthermore, it is self-documenting.

However, if assertions are turned off (for a release build) - it's back in "undefined" land again.

Better to add both, like in

assert(0);
return 0;

However, at the moment this is not possible since the return is "not reached" according to DMD ?

Links

See the corresponding page in the D Specification: DigitalMars:d/warnings.html


FrontPage | News | TestPage | MessageBoard | Search | Contributors | Folders | Index | Help | Preferences | Edit

Edit text of this page (date of last change: December 10, 2006 7:52 (diff))