autoconf
[Top][All Lists]
Advanced

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

Re: Checking $host for 64-bit code generation


From: Ralf Wildenhues
Subject: Re: Checking $host for 64-bit code generation
Date: Tue, 24 Jun 2008 08:10:01 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

* John Calcote wrote on Mon, Jun 23, 2008 at 10:02:30PM CEST:
> 3. The code was particular to MS Windows. In these situations, it's
> pretty clear that MS doesn't care about portable code.

But what about w64?  Haven't they, at least as an afterthought,
introduced typedefs that are correct to use in either case?

> Here are a few examples from the source:

> #if defined( FLM_WIN) && defined( FLM_64BIT)
>    f_sprintf(pszTmp, "Unfreed Pointer: 0x%016I64x\r\n",
>       (FLMUINT)(&pHdr [1]));
> #else
>    f_sprintf(pszTmp, "Unfreed Pointer: 0x%08x\r\n",
>       (unsigned)((FLMUINT)(&pHdr [1])));
> #endif

That should either be a wrapper function to print a pointer, or a system
or config header that provides the needed #defines for both the printf
modifier and the type cast (similar to what inttypes.h and stdint.h
provide).  Between Autoconf and gnulib there exist lots of macros to
check for this stuff, and provide missing C99 bits.

It's usually more maintainable to keep platform specifics in one place
than sprinkle them around all over the code.

> [Win] - - - - - - - - - - - - - - - -
> 
> #ifdef FLM_64BIT
>    DWORD64 udDisplacement;
> #else
>    DWORD   udDisplacement;
> #endif

Same thing, there should be a DWORD_OR_DWORD64 type.  I cannot imagine
MS would not provide one (with new enough systems, at least; for older
ones one could still default that to DWORD).

Cheers,
Ralf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]