Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!idris.id.dk!jj From: jj@idris.id.dk (Jesper Joergensen [ris]) Newsgroups: gnu.g++.lib.bug Subject: Possible bug in (version 1.36.1) Message-ID: <8912201451.AA16126@idris.id.dk> Date: 20 Dec 89 16:51:27 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 47 Hello Denmark calling, I've just considered using the assertion macros in and was inspecting the definitions (version 1.36.1) out of pure curiosity. I found something which seemed strange to me and decided to report it, since it might be a bug. The definitions effectuated when NDEBUG is defined are: #define assert(ignore) #define assertval(ex) (ex) which tells me that assertval is intended for use in an expression, since this dummy definition returns the value of the test expression itself, while assert is meant for use as a statement. The definition of assertval in effect when NDEBUG is undefined is: #define assertval(ex) \ ((ex) ? 1 : \ (__eprintf("Failed assertion " #ex " at line %d of `%s'.\n",\ __LINE__, __FILE__), abort (), 0)) but this macro doesn't return the exact value of the given expression itself, only an indication that the expression is true. Besides that it is completely identical to assert in this case. If assert is meant for use as a statement, then why isn't it defined as a regular if statement. Is this an error or is it intentional and if so why ?? (side effects ??) By the way: I can see what NDEBUG is used for, but is it for user control or controlled by the system/compiler ?? Is it used for anything else ?? That's all for now, I'll return some other time Marry Christmas and a Happy new year Jesper Jorgensen (known as 'JJ the famous') Research associate Department of Computer Science Technical University of Denmark DK-2800 Lyngby DENMARK