On Mon, Sep 12, 2011 at 12:22 AM, Francois Gouget fgouget@free.fr wrote:
- assert(0 && "bad encoding in load_encoding_name");
- assert("bad encoding in load_encoding_name");
Hello,
assert() is a debug macro which generates some code such that, during runtime: if the argument is non-zero, nothing happens; if the argument is zero, a message like "Assertion `X' failed" is printed (where X is exactly the expression that was given as an argument to assert, string-ified).
assert(X) is something like: "I assert that at this point in the code, X holds; if you get there and X doesn't hold, tell me and abort the program".
So assert(0 && "msg") will always trigger an assertion failure and tell you something like "Assertion `0 && "msg"' failed" then exit, which is good. If you change it to assert("msg"), condition will always be true so assertion will never be triggered.
Octavian
On Mon, 12 Sep 2011, Octavian Voicu wrote:
On Mon, Sep 12, 2011 at 12:22 AM, Francois Gouget fgouget@free.fr wrote:
- assert(0 && "bad encoding in load_encoding_name");
- assert("bad encoding in load_encoding_name");
Hello,
assert() is a debug macro which generates some code such that, during runtime: if the argument is non-zero, nothing happens;
Ah right. Sorry for the noise.