On Thu, 11 Aug 2011 14:20:46 +0300, bearophile <[email protected]> wrote:

Contracts contain asserts,

But contracts are removed in release executables too, no?

sometimes asserts are kept in the released binaries too (dmd has many asserts active) and those asserts hopefully contain an error message for debugging.

Consider: regular asserts are removed from release executables. assert(0) compiles to a HLT instead of nothing merely because it has practically no overhead (only one byte of machine code)!

I think you're confusing the purpose of asserts with something else again. Besides, there are some who think that the special case of assert(0) is confusing/inconsistent with regular asserts enough, why do you want to enlarge that distinction even more?

I don't think that removing them improves the program and its usage in any way.

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.

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.

You're not supposed to use -release if you want to know what happened. 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.

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...

This is the least of my concern.

--
Best regards,
 Vladimir                            mailto:[email protected]

Reply via email to