Arjan van de Ven wrote:
Jeff Garzik wrote:
always avoid bitfields. They generate horrible code, and endian problems abound (though no endian problems are apparent here).

they generate no worse code than open coding the checks for these feature flags...

That would be the logical assumption, but reality does not bear that logic out to be true.


I just checked a small example and gcc just generates a testb with an immediate value, which isn't all that bad code.

Do you remember which gcc you tested with?

gcc 2.95, gcc 3.x, gcc 4.x, ...  on multiple architectures, not just ia32.

It's simple logic: using machine integers are the easiest for the compiler to Do The Right Thing, the easiest way to eliminate endian problems, the easiest way for programmers to read and understand struct alignment.

Just say no to bitfields.

        Jeff



-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to