httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: [PATCH] PR#344: 64-bit cleanup
Date Mon, 14 Jul 1997 01:54:08 GMT
On Sun, 13 Jul 1997, Jim Jagielski wrote:
> Of course, ANSI specifically derides this assumption as well.

Yup, which is why I'm not fighting hard on this one.  I hope to find time
to look at other programs to find out what they do for this... unless
someone beats me to it.

I did propose a truly portable ANSI solution -- which allowed us to fall
back to unions should we need to:

#ifdef NEED_ANSI_GENERIC_DATA
typedef union {
    long __i;		/* could use an int here, whatever */
    void *__p;
} generic_data;
#define GENERIC_INT(x)	((x).__i)
#define GENERIC_PTR(x)	((x).__p)
#else
typedef long generic_data;
#define GENERIC_INT(x)	(x)
#define GENERIC_PTR(x)	(x)
#endif

usage:

    GENERIC_INT(foo) = (int)bar;

    char *x = (char *)GENERIC_PTR(y);

But these can't be portability statically initialized since ANSI declares
that a static initializer for a union must initialize the first element of
the union.

Dean


Mime
View raw message