On Fri, 26 Sep 1997, Andrew Helm wrote:
-+> They're not completely portable, though, and their only
-+> merit lies in the fact that they aren't limited to the
-+> size of a variable type like bitvectors.
-+
-+A bit field is completely portable. A bit field is a part of
-+the ANSI C standard. Just don't rely on anything that is
-+implementation defined, and you'll be fine. As for the
-+size of bitfields not being limited: bullshit. A bitfield
-+can't be greater than 16 bits. (At least, not in a conforming
-+ANSI C program.)
Agreed that bitfields are a part of the ANSI C standard, but
that doesn't mean they're completely portable. Many compilers,
primarily DOS/Windows based ones, choose different implementations
of standard things, and the like.
And you misunderstood what I said when I said a bitfield is not
limited by the size of a variable. I meant the *number* of
bits you have in the structure is not limited by the size of a
variable. In other words, you can have:
struct bitfield {
unsigned int bit0 : 1;
unsigned int bit1 : 1;
.
.
.
.
unsigned int bitN : 1;
};
well over 16 of them...
-+
-+> Bitfield:
-+>
-+> int bit0 : 1;
-+
-+This should really be unsigned int or signed int to be
-+portable.
Oh, sorry, I should have made my quick little examples completely
portable across multiple operating systems. <roll eyes> Don't
get into this semantic bullshit, again, Andrew--it's annoying and
unnecessary. Yes, they should be "unsigned" (if they're not then
setting them to 1 will actually set them to -1), but it's hardly
necessary for a simple example to conform. But, to make you
happy, Andrew, the example I've included in this message uses
"unsigned int".
--
Daniel Koepke -:- dkoepke@california.com -:- [Shadowlord/Nether]
Think.
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/08/00 PST