Re: Bitfields from "Daniel Koepke" at Sep 26, 97 08:10:00 am

From: Andrew Helm (ashe@IGLOU.COM)
Date: 09/26/97

> 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.

If it chooses to implement bitfields differently than the
Standard specifies return the compiler and demand your
money back.

> 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:

Well, in that case it's unfair to compare multiple bitfields
to a single bitvector. In other words, your assertion that
bitfields aren't limited size while bitvectors are is false.

> -+
> -+> 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".

Umm... actually, I mentioned it because it's not obvious. I
myself wouldn't have known it if I hadn't just looked up
bitfields and refreshed my memory.

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

This archive was generated by hypermail 2b30 : 12/08/00 PST