Re: Please clear my doubt

From: Joona I Palaste (palaste_at_cc.helsinki.fi)
Date: 12/02/03


Date: 2 Dec 2003 21:48:31 GMT

Christopher Benson-Manica <ataru@nospam.cyberspace.org> scribbled the following:
> Christopher Benson-Manica <ataru@nospam.cyberspace.org> spoke thus:
>> free( a );
>> if( a==NULL )
> ^^^^^^^^^^^^^

> Let me guess, UB?

Yes. (Or not necessarily, if a was originally NULL, in which case it
would be a comparison NULL==NULL, which is perfectly safe.)
But free() can't alter its argument anyway (no C function can), so the
if statement is pointless.

-- 
/-- Joona Palaste (palaste@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"'It can be easily shown that' means 'I saw a proof of this once (which I didn't
understand) which I can no longer remember'."
   - A maths teacher