halt with optional message?

bearophile bearophileHUGS at lycos.com
Thu Aug 11 04:20:46 PDT 2011


Vladimir Panteleev:

> Assert reasons should never be in release executables. Release executables  
> are often meant for redistribution and shouldn't contain messages intended  
> for debugging.

Contracts contain asserts, sometimes asserts are kept in the released binaries too (dmd has many asserts active) and those asserts hopefully contain an error message for debugging. How do you remove those error messages? I don't think that removing them improves the program and its usage in any way.

Also, here we are discussing about assert(0), it's a different kind of assert, that is kept in release mode too. If the program prints a debugging message and the user tells me the error message (this is right what has just happened to me), I am able to know what assert(0) has fired even if the user is not using a debugger. So I don't think you are right.


A simple function would be better suited for this, I think.

puts() is not pure, so if you add a puts() in a function, the function can't be pure. So the function that calls this function can't be pure...

Bye,
bearophile


More information about the Digitalmars-d mailing list