halt with optional message?

bearophile bearophileHUGS at lycos.com
Thu Aug 11 04:55:29 PDT 2011


Vladimir Panteleev:

> Besides, there are some who think that the special case of assert(0) is  
> confusing/inconsistent with regular asserts enough,

The discussion ended with no changes in D because I think for Walter it's a problem not large enough to be worth a change in D.


> If I'm writing a commercial, closed-source program meant for  
> redistribution, including any unnecessary information that helps reversers  
> to understand how the program works is just stupid.

Then you don't add a message to assert(0), so it keeps being translated with just an efficient HLT.

The purpose of D programs is varied, there are not just closed source programs to sell. The user of a small D program I have recently written was sitting in a room near mine. He has hit an assert, he has told me what the message is, and I have fixed the code and sent him the fixed binary. The program is now working, it seems.


> Failed asserts in release executables should never happen, unless your  
> program is buggy. If your program is buggy, don't use -release until  
> you've debugged it.

Sometimes I think it's not buggy, but it contains one or more bugs :-(


> This is the least of my concern.

I'm trying to use purity more and more :-) It helps me avoid some troubles. As more and more stuff in Phobos becomes pure, I suggest you to use this attribute more in your code.

The purpose of this thread was not just to ask for a feature (I use Bugzilla for that), but also to know if this is first of all a good idea. Thank you for your answers, I am seeing the situation a bit better now.

Bye,
bearophile


More information about the Digitalmars-d mailing list