pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Portable replacement for __WORDSIZE define?

On Fri, Dec 30, 2022 at 06:52:26PM +0100, Martin Husemann wrote:
> On Fri, Dec 30, 2022 at 06:32:39PM +0100, Alexander Schreiber wrote:
> > The __WORDSIZE issue shows up in libglusterfs/src/glusterfs/dict.h:
> > 
> >  322  /* POSIX-compliant systems requires the 'time_t' to be a signed integer. */
> >  323  #if __WORDSIZE == 64
> >  324  #define dict_get_time(dict, key, val) dict_get_int64((dict), (key), (val))
> That is totally nonsense.
> You can use _LP64 to select between pointer being 64bit and pointer
> being 32bit, but that obviously is complete unrelated to the size of
> time_t (which is always 64bit on NetBSD and most modern systems).

I suspect they couldn't figure out a quick way to check for 32/64 bit
time_t and noticed that at least on some systems:
 sizeof(void *) == sizeof(time_t)
e.g. just checked:
 - amd64 Linux machine here: both 64 bit
 - armv7l (Raspberry Pi 2 Model B Rev 1.1): both 32 bit
so they cheerfully went and used that as a proxy for that.

> You need to add a configure test for that property.

Sounds like fun. I'll go take a look.

Kind regards,
"Opportunity is missed by most people because it is dressed in overalls and
 looks like work."                                      -- Thomas A. Edison

Home | Main Index | Thread Index | Old Index