Re: Ike Naar



nick_keighley_nospam@xxxxxxxxxxx said:

<snip>

[...] I believe (meaning I can' remember where I read it)
that this is problematic

assert (p);

that it needs to be replaced with

assert (p != 0);

to be safe

Yes, that's required in C90 because assert requires an integer
expression (specifically, a value of type int). In C99, however,
assert(p) is safe because the requirement was slackened, so that
only a scalar expression is needed - and pointer values count as
scalar expressions. I wouldn't do it that way myself, partly
because C99 isn't portable enough yet but mostly because I prefer
to use relational expressions in cases where the object is not
specifically intended "booleanly", so to speak. Thus, I'm okay with
if(is_printer_ready) but not okay with if(balance). I recognise
that this is just a style thing, of course (in C99).

<snip>

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
.



Relevant Pages

  • Re: Libertarian cartoons
    ... plausible prose man wrote: ... Globally, if this practice ... I just assert that you can use little algorithms, ...
    (rec.arts.sf.written)
  • Re: Poor Darwin
    ... >>> I can see how a person determined to assert that dissidents are ... >>> ruthlessly destroyed by the oppressive scientific conspiracy would use ... >>> evolutionary science. ...
    (talk.origins)
  • Re: C routines for Special Functions
    ... method of error handling for functions that return doubles. ... like the assert macro in C. ... > of IT tear me a new asshole when a programmer of mine left an assert ...
    (comp.lang.c)
  • Chez Watt: We know it cuz we assert it
    ... Yet another Chez Watt moment for Bob: In the we know it cuz we assert ... < snip rest> ...
    (talk.origins)
  • Re: ...Such a simple and parochial people.
    ... Button win gives Silverstone boost ... So, then, using your logic one could assert that the Italians are a simple and parochial people when they flock to Monza when Ferrari is in winning form? ...
    (rec.autos.sport.f1)