[ANNOUNCE] inputproto 1.4.1

Barton C Massey bart at cs.pdx.edu
Thu Feb 15 08:16:07 PST 2007

In message <45D47947.90302 at c3sl.ufpr.br> you wrote:
>   #define DevicePresence(dpy, type, _class)                       \
>       {                                                           \
> -        extern int_XiGetDevicePresenceNotifyEvent(Display *);   \
> +        extern int _XiGetDevicePresenceNotifyEvent(Display *);  \
>           type = _XiGetDevicePresenceNotifyEvent(dpy);            \
>           _class =  (0x10000 | _devicePresence);                  \
> The question is: why the compiler does not emit an error here?

* In a nod to K&R C, ANSI C function declarations without a
  return type default to returning int.

* Function declarations only provide type information for
  later references to the function; if the declared function
  is never referenced, no loader symbol is emitted, so it
  doesn't matter that the declared function never exists.

* The default for functions that are called with no previous
  declaration is to accept arguments of any type and return

* gcc -Wall will emit several useful warnings, but only without
  -Wno-implicit, which is usually turned on to shut up some
  noise. With -Wall -Wno-implicit it will only whine that
  the return type in the declaration defaults to int, which
  may well be how Peter found the typo.

C is not my favorite application programming language.  In
Nickle (http://nickle.org) we have no warnings, only errors:
this bug could not have occurred quite the way it did.



More information about the xorg mailing list