Changeset 10883


Ignore:
Timestamp:
Sep 26, 2008, 1:53:35 PM (11 years ago)
Author:
gb
Message:

*printf format strings specify the width of their integer arguments (as
signed/unsigned "long", "long long", etc.) Since 64-bit Windows defines
"long" as a 32-bit integer, we have to use "long long" (e.g., "%llx") to
print a lisp object successfully, but printing a 32-bit lisp pointer
as a "long long" may print at least 32 bits of garbage ... Define
a few constants based on word size, and use implicit concatenation of
adjacent C string constants to hide this.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/macros.h

    r10718 r10883  
    9797#define LSEEK(fd,offset,how) lseek(fd,offset,how)
    9898#endif
     99
     100/* We can't easily and unconditionally use format strings like "0x%lx"
     101   to print lisp objects: the "l" might not match the word size, and
     102   neither would (necessarily) something like "0x%llx".  We can at
     103   least exploit the fact that on all current platforms, "ll" ("long long")
     104   is the size of a 64-bit lisp object and "l" ("long") is the size of
     105   a 32-bit lisp object. */
     106
     107#if (WORD_SIZE == 64)
     108#define LISP "%llx"
     109#define ZLISP "%016llx"
     110#define DECIMAL "%lld"
     111#else
     112#define LISP "%lx"
     113#define ZLISP "%08x"
     114#define DECIMAL "%ld"
     115#endif
Note: See TracChangeset for help on using the changeset viewer.