3 ms·
Performance is basically never easy to reason about unless we're literally talking about 10 line long for loops. Then, maybe. But that's not a typical case for
by blattimwind 8y ago
Performance is basically never easy to reason about unless we're literally talking about 10 line long for loops. Then, maybe. But that's not a typical case for most applications.
Writing portable C is genuinely hard. I doubt many people can write significant quantities C89 code that actually does the same thing on GCC and MSVC out of the box (or on LE and BE, or on different pointer models, or on different architectures).
- burfog 8y agoEven MSVC will do C99 these days. C89 is dead. Big-endian is nearly dead, even in consumer network gear. POWER still survives in high-end network gear, and there are some big-business things (think COBOL) still in use. Most people really shouldn't care about big-endian. Weird pointer models are dead. Even in the embedded world it has all gone byte-addressable, single-address-space, without hardware segments. The hardware does exist on x86, but modern systems effectively hide it. The pointer models are ILP32, LP64, and that abomination that Win64 uses. Within reason, even bitfields are now portable. Both gcc and msvc will assign them starting from the LSB. You might need a pragma to pack the bits, but both compilers support that. Speaking of that: lots of pragma is portable now! You can pack. You can do "once".
- blattimwind 8y agoI.e. somewhat portable code that might (and sometimes does) break randomly, because it isn't actually portable, standard C.
- burfog 8y agoIt is actually portable. It isn't 100% standard of course, and almost nothing is. Start with the fact that standard C is unable to have a GUI, unable to make a network connection, and unable to make a plain text editor that can respond immediately to any keystroke other than Enter. You can't even implement the functions to provide those features. Any program using any of those features is fully undefined by the C standard. Any interesting program is thus undefined by standard C.