-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 07/24/2009 04:14 PM, John Dennis wrote: > On 07/24/2009 03:04 PM, Stephen Gallagher wrote: >> I concur (and have mostly been ignoring the previous policy up to this >> point). >> >> The only comment I might make is that it may still be acceptable for >> true single-line if statements, e.g. > > yes, I would agree with this. > >> str = malloc(10); >> if(!str) return ENOMEM; > > However in this particular example I would prefer > > if ((str = malloc(10)) == NULL) return ENOMEM; > > This keeps it as a true single line and is consistent with: > > RECOMMENDED: Use the full condition syntax like (NULL == str) rather > than (!str). > > I think some folks have an issue with this type of compound expression > but I find it much more readable and expressive of intent, YMMV. FWIW > the coding standard doesn't cover compound expressions. >
Actually, I had been using "if (str != NULL)" in my code, and was told to simplify it to !str - -- Stephen Gallagher RHCE 804006346421761 Looking to carve out IT costs? www.redhat.com/carveoutcosts/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iEYEARECAAYFAkpqGEcACgkQeiVVYja6o6NQdACfXWzRUh+wI614aOt9duIDN8eT f+EAn31iiM2yHCV36lqpKW9EHjnkXMUJ =CBlL -----END PGP SIGNATURE----- _______________________________________________ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel