On 2020-09-12, at 10:23:15, Bernd Oppolzer wrote:
> 
>     ... coding like "if (! ptr) ..." will work.
> /* I don't like such coding, BTW; if I see such coding, I replace it with "if 
> (ptr != NULL)"  */
>  
Why?  It's well-specified in the standard.  I consider
the longer form a pleonasm akin to
"if ( <boolean-expression>) == TRUE ) ..."
I've seen similar code; the "== TRUE" is noise.

>     ...
> Maybe, if you overlay the pointer with an int, assigning zero could work,
> because zero addresses in pointer variables are not translated and
> dereferencing such pointer variables could still work?
>  
Type punning.  Most implementations state that the
effect of type punning is implementation-dependent
or unpredictable.

-- gil

Reply via email to