15.10 ANSI-C and POSIX Portability

The MIT Release 5 X distribution is compliant with ANSI-C and POSIX standards, and portable across a wide variety of platforms. While the goal of the ANSI-C and POSIX standards is portability, many systems do not implement these standards, or do not implement them fully, so the MIT R5 distribution defines new header files that attempt to mask the differences between systems. The header files are <X11/Xfuncproto.h>, <X11/Xfuncs.h>, <X11/Xosdefs.h>, and <X11/Xos.h>. None of these files are part of the official R5 standard, so they may not be shipped with your system. But they can be very useful in writing portable applications, so we have included them with the code from this book, which you can get as described in the Preface.[57]

15.10.1 <X11/Xosdefs.h>

The file <X11/Xosdefs.h> defines symbols that describe a system’s support for ANSI-C and POSIX. Symbols that describe a system’s support for other standards may be added in the future. It defines two new symbols, X_NOT_STDC_ENV and X_NOT_POSIX, for systems that do not have the ANSI-C and POSIX header files, respectively. When standard header files exist, your code should include them. On systems which do not have them, however, attempting to include them would cause a compilation error. The symbols in <X11/Xosdefs.h> allow you to write code that takes the right action in either situation. Note that X_NOT_STDC_ENV is different from __STDC__, which simply indicates whether or not the compiler supports ...

Get XLIB Programming Manual, Rel. 5, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.