News for hackers. Stuff that matters.
Re:Certificate Verification Issue - GnuTLS by bodyfour on Tuesday March 04, 2014 @10:09PM (#7345007)
I'm usually not much of a Java fan, but making bool a stricter type was a good change. I always write my C code as if it had the same rules. For example, if you have:

    bool b;
    int i;
    unsigned u;
    void *p;
You could write code that looked like:

    if (b && i && u && p)
...and some people would even consider that idiomatic. I'd write the same test as:

    if (b && (i != 0) && (u > 0) && (p != NULL))
which is a little longer but, IMO, clearer. If the compiler enforced that style this family of bug would happen a lot less.

In a similar vein, I wish enums had strict conversion rules. C++11 finally gives us that with "enum class", but I don't think anything similar exists in C.

There are no comments on this comment yet.