3 ms·
C is write once, compile anywhere... so long as you restrict yourself to standard C, including the library. Different implementations have different levels of s
by int_19h 6y ago
C is write once, compile anywhere... so long as you restrict yourself to standard C, including the library. Different implementations have different levels of standard compliance, but you are still able to say, "this will do X on any conformant hosted C89 implementation".
The moment you start doing things like threads or shared libraries, yeah, it all breaks down very quickly. But that isn't standard C.
- sumtechguy 6y agoEven things like printf/sprintf act differently from library to library. trust me, read the docs on your lib. Most of the time they are the same but not always. It is one of those things that looks like it works but in practice there are a ton of gotchas. Most of the more mature libraries are getting better but there are some edge cases out there.
- int_19h 6y agoThey are different mostly because of different standards that libraries support - C90 has a baseline list of %-specifiers, but C99 added a bunch more, and then I think POSIX also has some now? Plus extensions. But I can't think of any implementation that doesn't conform to C90 in that regard. So long as you don't venture into implementation defined / UB category...