Am 23.10.2010 22:24, schrieb Jeff Trawick:
On Sat, Oct 23, 2010 at 3:58 PM, Graham Leggett<[email protected]> wrote:
On 23 Oct 2010, at 9:51 PM, William A. Rowe Jr. wrote:
@@ -325,7 +325,7 @@ struct proxy_worker {
apr_port_t port;
char keepalive;
char disablereuse;
- int is_address_reusable;
+ int is_address_reusable:1;
proxy_conn_pool *cp; /* Connection pool to use */
proxy_worker_stat *s; /* Shared data */
void *opaque; /* per scheme worker data */
No; this is a dis-optimization. You have added int-bitmath cpu cycles
to a simple int test, without gaining any storage. Huh?
Are you sure?
I would expect a compiler optimiser to do the most appropriate thing, and it
gets us out of the habit of allocating an int or a char every time we need a
boolean flag.
It can't reorder fields, and pointers and integers need to be on
"natural" boundaries for performance (or even outright functionality
on some platforms). So there will be padding after the bit.
Some Intel ABI spec would show alignment requirements for a notable
example platform, absent of any packing pragmas.
in the past I faced more than once probs where different compilers did
different padding - this might be called a compiler bug, but it resulted
in incompatible binaries where structs where packed differently. I think
we should avoid bitfields where ever possible.
Gün.