[LLVMdev] ssize_t definition in DataTypes.h

Michael Smith Michael.Smith at synopsys.com
Thu Apr 1 18:29:13 PDT 2010


LLVM doesn't look completely 64-bit capable on Windows. One problem I see is in DataTypes.h where ssize_t is defined for Windows.

My understanding is in general, ssize_t is a 32-bit integer on 32-bit machines, and a 64-bit integer on 64-bit machines. So for Windows, this type definition should vary for 32 and 64-bit machines.

A potential implementation would be:
#ifdef _WIN64
typedef __int64         ssize_t;
#else
typedef _w64 int        ssize_t;
#endif

A discussion of "_w64" - http://msdn.microsoft.com/en-us/library/s04b5w00(VS.71).aspx. It's only supported on later versions of Visual Studio, so something like
#if !defined(_W64)
# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
#  define _W64 __w64
# else
#  define _W64
# endif
#endif
would be needed.

Regards,
Michael Smith
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100401/dc25bf4b/attachment.html>


More information about the llvm-dev mailing list