Why is it difficult to write portable C programs?

前端 未结 10 2622
野的像风
野的像风 2020-12-14 03:50

I want to know, why is it too hard to make a program run in many OSes, like Windows and Linux, without including glue code. They all share the same architecture (x86), so I

10条回答
  •  南方客
    南方客 (楼主)
    2020-12-14 04:07

    Making your basic C program that computes a little and prints results work is easy.

    The problem is that any C program that does anything substantial is going to rely on a lot of services from the operating system, and those differ in many ways. File I/O tends to be similar, but when it comes to graphics, they differ a lot. And that is the crux of the problem.

提交回复
热议问题