[333] in Kerberos_V5_Development

home help back first fref pref prev next nref lref last post

Re: Mystifying problem with function prototypes....

daemon@ATHENA.MIT.EDU (Ralph Swick)
Tue Oct 16 16:20:10 1990

To: tytso@ATHENA.MIT.EDU
Cc: krbdev@ATHENA.MIT.EDU
In-Reply-To: Your message of Tue, 16 Oct 90 16:07:31 -0400.
Date: Tue, 16 Oct 90 16:19:40 EDT
From: Ralph Swick <swick@ATHENA.MIT.EDU>

    What was the crocky stuff in the X headers?

from X11/Intrinsic.h:

...
typedef char Boolean;
...
#if NeedWidePrototypes
#define Boolean		int
#define Dimension	int
#define KeyCode		int
#define Position	int
#define XtEnum		int
#endif /* NeedWidePrototypes */
...
extern void XtAddEventHandler(
#if NeedFunctionPrototypes
    Widget 		/* widget */,
    EventMask 		/* eventMask */,
    Boolean 		/* nonmaskable */,
    XtEventHandler 	/* proc */,
    XtPointer 		/* closure */
#endif
);
...
#if NeedWidePrototypes
#undef Boolean
#undef Dimension
#undef KeyCode
#undef Position
#undef XtEnum
#endif /* NeedWidePrototypes */

This method just kept the prototypes looking good.  If the types are
also used as return values, I use the uglier form:

extern XtGeometryResult XtMakeResizeRequest(
#if NeedFunctionPrototypes
    Widget 		/* widget */,
#if NeedWidePrototypes
    /* Dimension */ int /* width */,
    /* Dimension */ int /* height */,
#else
    Dimension		/* width */,
    Dimension 		/* height */,
#endif /* NeedWidePrototypes */
    Dimension*		/* replyWidth */,
    Dimension*		/* replyHeight */
#endif
);

    if we ever wanted to add the indirection, all we would have to do would
    be to replace libkdb.a with a version that had the extra code in it.

Fine; at least there *is* some rationale :-)

home help back first fref pref prev next nref lref last post