Re: Dynamic arrays

From: Alex (me_at_privacy.net)
Date: 10/29/03


Date: Wed, 29 Oct 2003 13:27:27 -0000


"sellountos euripides" <sellountos@mech.upatras.gr> wrote in message
news:bnod8n$p2p$1@nic.grnet.gr...
> >> if (test= NULL) printf("Can't allocate\n");
> > ^
> > Hur, hur!
> >
> > You want ==.
>
> To OP.
> That's why many programmers prefer to write:
> if (NULL==test) {
> /* ... */
> }
> To catch the error at compile time.

I prefer to increase the warning level from my compiler, which also sets off
an alarm bell in this type of situation:

int i, j;
/* ... */
if (i = /* whoops! */ j) { /* ... */ }

Alex