Better: (defn) More readable, less likey for errors, etc, etc, etc.
I have a chance to rewrite some C code that was written before there was a standard. Many #defines are used where there should be enums and lots of unions are defined but never used.
As long as I'm rewriting the code (and porting it from DOS to Linux) I'm seriously considering moving the unions to masked fields, then have a couple of functions, like setbit() and clearbit(), that I would define to accept a void*, int, int for the data, type of the data (from an enum), and which bit we should set/clear. I would then just use enums, bit-shifts, and all the bit-wise opps for setting/clearing the data.
I can just leave these as struct defns with unions and not worry about it. . .
Which way would be "better"?
EDIT: bit-shifts got ...... out???? Must have had a type-o.