[Vm-dev] '-DNDEBUG=0' and '-DDEBUGVM=1'
Mariano Martinez Peck
marianopeck at gmail.com
Tue Apr 26 08:37:13 UTC 2011
On Tue, Apr 26, 2011 at 10:18 AM, Stefan Marr <squeak at stefan-marr.de> wrote:
>
> Hi Mariano:
>
> On 26 Apr 2011, at 09:53, Mariano Martinez Peck wrote:
>
> > If I am compiling with -DNDEBUG=1 I expect the asserts() to be
> evaluating.
> NDEBUG is a short form for NO debug, I suppose.
> Let me cite the manpage:
>
> >>
> If the macro NDEBUG was defined at the moment <assert.h> was last included,
> the macro assert() generates no code, and hence does nothing at all.
> <<
>
> Thus, -DNDEBUG=0 and -DNDEBUG=1, as well as -DNDEBUG=foo have all the same
> effect: NO DEBUG, no assertions.
>
>
Thanks Stefan. In fact, you were right. If I DO NOT define DNDEBUG,
assertions. If I define it (with whatever value), no assertions. Now, I
think that I was to naive to understand Eliot's first answer:
"
NDEBUG is a Mac OS X/FreeBSD/Linux flag that controls asserts. To get
asserts working in Cog it was easiest to use this flag. So if NDEBUG=0
asserts are eliminated and if NDEBUG=1 they are included and cause a warning
to be printed to stdout when enabled (via a call to warning). See
platforms/Cross/vm/sqAssert.h. Hence NDEBUG=0 for production and NDEBUG=1
for debug and assert VMs.
"
So..I should have NOT understood them literal "Hence NDEBUG=0 for
production and NDEBUG=1 for debug" but instead that for debug I DO NOT
have to define NDEBUG but I do for production ?
And even more, when Igor said "and so it doesn't matters if it = 1 or = 0
because it is defined, but don't cares which value." he was correct.
> > And even more, asserta() seems to evaluates always.
>
> I don't know asserta(), I suppose it is `assert always`?
> The only thing I can tell you here is, that you probably need to refer to
> its implementation.
>
>
yes
Thanks Stefan
Mariano
> Best regards
> Stefan
>
> --
> Stefan Marr
> Software Languages Lab
> Vrije Universiteit Brussel
> Pleinlaan 2 / B-1050 Brussels / Belgium
> http://soft.vub.ac.be/~smarr
> Phone: +32 2 629 2974
> Fax: +32 2 629 3525
>
>
--
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20110426/b5cda722/attachment.htm
More information about the Vm-dev
mailing list