On Mon, 18 Jul 2016 04:40:14 -0700, pedro1492 wrote:
> In linux, long is 32-bits for 32-bit OS or 64-bits for 64-bit OS. This
> causes problems for an old package, because included X11 header has typdef
> unsigned long.
> There are many places where the size would require extra switch-case
> clauses to handle 32 or 64 bits. Hundreds of source files would need to
> be scrutinised. Simply hacking the X11 header file to change long to int
> makes the problem go away, but it not really best practice.
> So I hoped some compiler options could change "long" size.
The main problem with this is that if you include any headers for other
libraries, you need to link against versions of those libraries which were
built with a 32-bit "long".
In general, client code communicates with Xlib using the platform's base
types (e.g. int or long), whatever those happen to be. In situations where
data is being passed from the client to the server without any conversion,
you'd normally use the fixed-size types CARD8, CARD16 and CARD32. Most
"handle" types (e.g. XID, Atom) are aliases for CARD32, i.e. they'll be
32-bit regardless of the size of "long".