3 ms·
> You can also do the platform checks in the build system instead and have multiple per-platform C files implement APIs for portability shims -- but given that
by dvfjsdhgfv 8y ago
> You can also do the platform checks in the build system instead and have multiple per-platform C files implement APIs for portability shims -- but given that the platform check is likely unportable (at least in make as specified by POSIX), you're just making different portability assumptions.
And yet, it seems that's what the authors of the article did:
The best method of managing system-specific
variants is to follow those same basic principles:
define a portable interface to suitably-chosen primitives, and then implement different variants of the primitives for different systems. The well-defined interface is the important part: the bulk of the
software, including most of the complexity, can be
written as a single version using that interface, and
can be read and understood in portable terms.