assert or sqAssert? [was: Re: Source Forge Changes for 3.2.1]

Stephan Rudlof sr at evolgo.de
Mon Dec 24 08:54:03 UTC 2001


John M McIntosh wrote:
> 
> At 7:10 AM +0100 12/24/01, Stephan Rudlof wrote:
> >Marcus Denker wrote:
> >>
> >>  On Fri, Dec 21, 2001 at 01:14:47PM -0800, John M McIntosh wrote:
> >...
> >>  >
> >>  > Ah, could you submit a change set for that I must have changed that a
> >>  > few months ago. The problem is assert is also defined in the mac bsd
> >>  > headers somewhere. The assert should really be changes to
> >>  > SqueakAssert or something versus being deleted.
> >>
> >>  Ok.
> >>
> >
> >The current workaround is to have >>sqAssert: in the LargeIntergersPlugin.
> >I'm not happy with this.
> >
> >I just want to have an assert function, which does exactly what you expect
> >from such a function.
> 
> Well in the bsd <assert.h> we have
> #define assert(expression)  \
>    ((void) ((expression) ? 0 : __assert (#expression, __FILE__, __LINE__)))
> 
> then you do
> static int assert(int aBool) {
>         /* missing DebugCode */;
> }
> 
> Then the GNU compiler gets grumpy.

Not for the Linux version! *Where* happens this '#include <assert.h>'
leading to this clash? There is no such include here.
Here is just
---
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#include "sqVirtualMachine.h"
#include "sqConfig.h"
#include "sqPlatformSpecific.h"
---
for LargeIntegers.c and none of them seem to include <assert.h>. Possibly
this behaves different for you?

> Note that assert is also used in
> b3dAlloc.c which is one of the places the #include <assert.h> is
> invoked to pickup the BSD definition.

But this shouldn't affect the compiling of LargeIntergers.c, I think.

> I'm assuming you could revert to use #include <assert.h> then use
> assert as defined for BSD assert versus your own version.

I just wanted (I'm not really sure, see below) to have the most common
ANSI-C assert. If your BSD assert (what means BSD here?) is such a thing,
OK.

> Mmm right
> now it appears your assert doesn't do anything? Should it?

In debug plugin generation mode it does something. One reason to introduce
it has been (now it seems to be the only one for this plugin), that per
default there is *no* '#include <assert.h>' for plugins. So write your own
or change the generation of plugin file preambles.

One problem with using the standard 'assert()' in C is its radical
behaviour: my K&R book says, that it 'abort()'s. Defining our own could
modify this behaviour and differentiate between different plugins (assumed
the current name clash is solved).


Greetings,

Stephan

> 
> --
> --
> ===========================================================================
> John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
> Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
> ===========================================================================

-- 
Stephan Rudlof (sr at evolgo.de)
   "Genius doesn't work on an assembly line basis.
    You can't simply say, 'Today I will be brilliant.'"
    -- Kirk, "The Ultimate Computer", stardate 4731.3




More information about the Squeak-dev mailing list