[comp.windows.x] Function declarations in Xlib

davidh@dent.berkeley.edu (David S. Harrison) (01/21/89)

Offline,  Mr. Scheifler has pointed out that there is a problem with
the prototypes I recently announced to this group.  Until I get around
to fixing the problem,  if you use an ANSI compiler,  you should only
use the prototypes to check your arguments (don't attempt to link
executables).

The current ANSI draft allows compilers to use a different (more
compact) argument list representation when calling functions with
prototypes.  For example, under old C,  when you pass a character on
the argument list,  it is automatically cast into a long.  Under ANSI
C,  if a function prototype exists saying that the argument is a
character,  the compiler can generate code that passes only one byte. 

Since Xlib itself is not compiled with prototypes,  it expects all
arguments to be upgraded.  The prototypes I produced have the actual
argument types.  Thus,  compiling a program with the prototypes may
produce function calls in your program that don't match what the
library functions expect.

In the near term,  I will try to produce upgraded prototypes (e.g.
where the prototype currently says `unsigned short width',  it will
say `long width').  This should work on all of the ANSI compilers I
know about (including gcc).  The longer term solution is to produce a
function prototype version of Xlib.

				David Harrison
				UC Berkeley Electronics Research Lab
				(davidh@ic.Berkely.EDU, ...!ucbvax!davidh)