httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralf S. Engelschall" <>
Subject bitlength for enums: portable?
Date Thu, 30 Apr 1998 17:26:45 GMT

Jens-Uwe Mager currently tries more AIX versions (4.1.5, 3.x - I've only
access to 4.2) and already sent me some diffs. One change which is needed for
AIX's cc is to remove the bitlength specification of an enum-based variable in

enum special {
typedef struct {
    char *name;                 /* header name */
    char *regex;                /* regex to match against */
    regex_t *preg;              /* compiled regex */
    table *features;            /* env vars to set (or unset) */
    enum special special_type : 4;  /* is it a "special" header ? */
    unsigned icase : 1;     /* ignoring case? */
} sei_entry;

Is this really portable to specifiy a bitlength when using an enum?  Is it
really ANSI C conforming? We think this only is ok for ints and unsigned ints
although enums are implemented like ints.

On the other hand: Why should we optimize memory space such dramatically here?
We can leave out the ":4" and don't worry about some compilers which would
complain else.

What should we do? Wrap with an "#ifdef AIX" (grrrr) or simply removing the
":4" and waste 4 bits of disk space?

                                       Ralf S. Engelschall

View raw message