Author Topic: HOw to : NDEBUG and how to use it...  (Read 4834 times)

Offline toutarrive

  • Multiple posting newcomer
  • *
  • Posts: 11
HOw to : NDEBUG and how to use it...
« on: November 07, 2007, 05:11:51 pm »
Hello,

I've got problem with using Ndebug... Does someone could indicate me a link to this topic or even trying to sumerize the use of this macro. thanks

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: HOw to : NDEBUG and how to use it...
« Reply #1 on: November 08, 2007, 09:40:58 am »
NDEBUG is the traditional, standard way of removing the assert() macro (look into assert.h). There is nothing magical about it, just define NDEBUG in the project options, that is all.
Every modern C book should contain an explanation (my copy of Kernighan/Ritchie from 1977 does not).

Some library maintainers think they are Smarter than the standard and do their own thing. They sometimes expect RELEASE to be defined, or they expect BUILD to be set to either DEBUG or RELEASE.
That is of course possible, it just isn't very good practice, as it adds complexity that is just not necessary. It requires third parties using the libraries to remember extra stuff when they could have had it a lot easier the standard way.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline toutarrive

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: HOw to : NDEBUG and how to use it...
« Reply #2 on: November 08, 2007, 07:20:21 pm »
Thanks again Thomas.

 I'll have a deep look at the assert.h and get more information by myself.

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: HOw to : NDEBUG and how to use it...
« Reply #3 on: November 11, 2007, 09:49:25 pm »
my copy of Kernighan/Ritchie from 1977 does not
Are you working on a software books museum ?  :D

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: HOw to : NDEBUG and how to use it...
« Reply #4 on: November 12, 2007, 09:47:36 am »
No, that just so happens to be the book I learned C with. It's a horror to read (Unix inventors should not write books...), and the particular edition I have must definitively be ranked #1 in the top ten for books with the ugliest cover. Still, it's a classic, I love it.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."