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

Stephan Rudlof sr at evolgo.de
Fri Dec 28 03:01:22 UTC 2001


John M McIntosh wrote:
> 
> >John M McIntosh wrote:
> >>
> >>  >
> >>  >Not for the Linux version! *Where* happens this '#include <assert.h>'
> >>  >leading to this clash? There is no such include here.
> >>
> >>  Looking deeper into this it seems that assert.h is included by
> >>  Apple's core foundation header. This header is gotten to by
> >>  sqConfig.h which on the mac  under OS-X includes
> >>  "/Developer/Headers/FlatCarbon/MacTypes.h" which
> >>
> >>  includes
> >>
> >>"/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/CarbonCore.h"
> >>  which includes
> >>
> >>"/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h"
> >>
> >>  which at some point includes assert.h found at
> >>  "/usr/include/gcc/darwin/2.95.2/g++/../assert.h"
> >
> >What about just
> >       #undef assert
> >(I think without braces) just after the
> >       #include "/Developer/Headers/FlatCarbon/MacTypes.h"
> >in sqConfig.h?
> >This should allow the inclusion of headers potentially using 'assert()'s,
> >but removes its definition for the Squeak sources.
> >Have you tried this approach?
> 
> Well we could but I think the question then is are we using assert as
> we know a unix assert, or are we using some other specialized
> sqAssert. I think overriding the unix assert could be confusing to
> some people.

That's a point.

> Also you then get into interesting games here to ensure
> our assert is used versus the unix assert.

This shouldn't be a problem: just #undef it if necessary (#undef'ing at the
begin of each - automatically generated - plugin should be sufficient;
remark: so far - until your problem for *one* specific platform - there
wasn't any assert problem).

> Right now you have an
> assert in LargeIntegers.c but that's different than the one found in
> other locations in the source code.

Which source code? The ST #assert: throws an exception and therefore halts
the program, what is quiet similar to my assert (I admit that the ST one is
not as radical).

I don't want to ride the horse to death (correct?). If you and others are
lucky with it, let it be #sqAssert:. But then populate please (e.g. by ST
and/or Swiki docu), that it is *forbidden* to use an assert() function like
the ST #assert: in Slang, since it would conflict with the Unix one (after C
code generation). Otherwise others could easily walk into the same trap
(mostly it would work with their platform, but not with all).

Is this a compromise?


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