Writing cross-platform apps in C

后端 未结 7 591
死守一世寂寞
死守一世寂寞 2020-12-31 08:56

What things should be kept most in mind when writing cross-platform applications in C? Targeted platforms: 32-bit Intel based PC, Mac, and Linux. I\'m especially looking for

7条回答
  •  一个人的身影
    2020-12-31 09:24

    Try to avoid platform-dependent #ifdefs, as they tend to grow exponentially when you add new platforms. Instead, try to organize your source files as a tree with platform-independent code at the root, and platform-dependent code on the "leaves". There is a nice book on the subject, Multi-Platform Code Management. Sample code in it may look obsolete, but ideas described in the book are still brilliantly vital.

提交回复
热议问题