Reliable portability for C code without relying on the preprocessor

Posted by Yktula on Stack Overflow See other posts from Stack Overflow or by Yktula
Published on 2010-04-19T01:36:57Z Indexed on 2010/04/19 1:43 UTC
Read the original article Hit count: 310

Filed under:
|
|
|

Relying on the preprocessor and predefined compiler macros for achieving portability seems hard to manage. What's a better way to achieve portability for a C project? I want to put environment-specific code in headers that behave the same way. Is there a way to have the build environment choose which headers to include?

I was thinking that I'd put the environment-specific headers into directories for specific environments. The build environment would then just copy the headers from the platform's directory into the root directory, build the project, and then remove the copies.

© Stack Overflow or respective owner

Related posts about c

    Related posts about make