On Mon, Aug 27, 2001 at 04:08:25PM +0200, Pavel Novy wrote:
>...
> I agree this is an undesirable way for bitfields to be aligned, but this
> agrees with MSVC, upon which we based the bitfield layout. (In MSVC the
> smallest we can make the struct is 4 bytes!)
>
> I think the way to work around this is to change the bitfield base type to
> "unsigned char". The type of the bitfield is used in determining how it is
> aligned; thus, using a smaller type will require a smaller alignment.
>...
> --- util_uri.h.orig Mon Feb 26 16:49:32 2001
> +++ util_uri.h Mon Aug 27 15:44:41 2001
> @@ -106,10 +106,10 @@
>
> unsigned short port; /* The port number, numeric, valid only if port_str !=
>NULL */
>
> - unsigned is_initialized:1;
> + unsigned char is_initialized:1;
>
> - unsigned dns_looked_up:1;
> - unsigned dns_resolved:1;
> + unsigned char dns_looked_up:1;
> + unsigned char dns_resolved:1;
>
> } uri_components;
Screw the bitfields. Just change all of them to plain old unsigned chars.
(and apr_byte_t in APR). There is no reason to be miserly with bits here.
Cheers,
-g
--
Greg Stein, http://www.lyra.org/