@need 3200

@node Portability Assumptions in the Hackerlab C Library
@appendix Portability Assumptions in the Hackerlab C Library

The @code{makefiles} used to compile the library are specific to @emph{GNU
Make}, available from the Free Software Foundation
(@url{http://www.gnu.org} ).


The implementation of the Hackerlab C Library is written to make
conservative use of standard C and Posix and opportunistic use of the
advanced features of GNU C.  It should compile cleanly using nearly
any ANSI C compiler in nearly any environment that claims to be
(substantially) conformant to the @emph{Posix.2} standard (@emph{ISO/IEC 994502:
1993 (ANSI/IEEE Std 1003.2 - 1992}).  If compiled with a GNU C
compiler, the implementation will take advantage of some non-portable
features such as function in-lining -- but this is strictly optional.


The Hackerlab C library is written with a few assumptions that are
true in many but not all implementations of C:


@strong{0.} Values of type @code{char} and of type @code{unsigned char} are 8-bit
values.


@strong{1.} All character code points refer to Unicode characters.  For code
points in the range @code{0..255} (including character constants in C
programs), this is compatible with ISO 8859-1.  For code points in the
range @code{0..127}, this is compatible with ASCII.


There is one exception to this rule.  The library exports regexp
matching functions which are compatible with the Posix.2
specification.  Those functions should operate correctly with any
character encoding in the ISO @code{8859} family. (However, only ISO-8859-1
is used in our test suite.)


@strong{2.} @code{sizeof (long) == 4 or 8}


@strong{3.} @code{sizeof (void *) == 4 or 8}


@strong{4.} It is safe to cast between pointers and long integers.  In 
other words, after this code:

@example
@group
        unsigned long x;
        unsigned long y;
        void * p;
        void * r;
        ...
        x = (unsigned long)p;
        r = (void *)x;
@end group
@group
@end group
@end example

@noindent
this is true:

@example
@group
        r == p
@end group
@group
@end group
@end example

@noindent
and similarly, after:

@example
@group
        p = (void *)x;
        y = (unsigned long)p;
@end group
@group
@end group
@end example

@noindent
this is true:

@example
@group
        x == y
@end group
@group
@end group
@end example

Strictly speaking, this is a stronger requirement than simply:

@example
@group
        sizeof (long) == sizeof (void *)
@end group
@group
@end group
@end example



