[Vm-dev] [Cog] Trying to understand #assert:

Mariano Martinez Peck marianopeck at gmail.com
Mon Dec 20 09:22:17 UTC 2010


Hi Eliot. I noticed that in the Cog VM there are a lot of asserts in the
code. I am trying to understand them but I have a couple of questions:

- What happens with the code execution when an assert fails?  it stops the
execution?  it continues? it raises an error?  I tried to follow to the
definition of assert() but I only came to this:
# define assert(expr)  ((expr)||(warning(#expr " "
__stringifyNum(__LINE__)),0))

So....after time, I understood that when I compile in "development" and I
run with GDB, and I have something printed in the console like:

(primitiveIndexOf(GIV(newMethod))) != 0 8913

this means that in the line 8913 the assert has failed?  so, do I understand
correct?   when an assert fails, the code continues to execute, but it just
prints the expresion + number of line in the console?
if it doesn't fail, it doesn't print.

thanks in advance,

Mariano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20101220/f949116d/attachment.htm


More information about the Vm-dev mailing list