Gregory Pietsch wrote:
I'm writing a portable implementation of the C standard library for
http://www.clc-wiki.net and I was wondering if someone could check
the functions in math.h for sanity/portability/whatever. I'm almost
halfway through writing the over 200 functions needed to implement
C99's version of math.h, and I would like to have some feedback
and/or expert advice on my implementations.
Caution. Many of the standard library routines are intrinsically
not implementable with portable code. I suggest an enumeration of
these would be worthwhile, together with the sort of assumptions
needed for an implementation. We can start with malloc, realloc,
and free, which require assumptions about alignment and pointer
convertability.
A _lot_ can be done with only a very tiny section of non-portable
code, though. malloc/realloc/free need only two things - a way to get
a [moderately large] block of memory from the OS, and a way to figure
out pointer alignments. (Once a pointer _is_ aligned 'for any data
type', it can be converted to a pointer to any data type)