News for hackers. Stuff that matters.
Re:C extensions, portability, and alternative compilers by einpoklum on Monday May 25, 2026 @02:26PM (#48270017)
> Anyone who's written C knows that full ISO C standard-adhering code is an impractical rarity.

I've written quite a bit of C code and do not know that to be a rarity. Especially when it comes to libraries rather than applications, and FOSS as opposed to proprietary code.

> Most real world C code out there relies on non-standard behaviors and language extensions to varying extents

Maybe it depends on which domain you're working in. At companies whose target platform is not a PC, relying on idiosycratic behavior, or extensions, is difficult: The compiler for the target device may simply not support the bells and whistles of GCC or whatever, so you stick to C99, (or even C89, ugh) to be on the safe side. And even then there will be things which are standard, but... well, I would be wary of relying on them being supported robustly enough, e.g. variable-length arrays.

And of course, once your code does not target just one single machine then you're forced to have to worry about portability and standard compliance etc.

Re:C extensions, portability, and alternative compilers by bmink on Monday May 25, 2026 @04:00PM (#48270980)
Yes, while the article makes some good points the first paragraph was puzzling.
Re:C extensions, portability, and alternative compilers by kouosi on Monday May 25, 2026 @02:45PM (#48270222)
> And of course, once your code does not target just one single machine then you're forced to have to worry about portability and standard compliance etc.

Well linux exclusively usages gcc to compile.

Re:C extensions, portability, and alternative compilers by fanf2 on Monday May 25, 2026 @03:26PM (#48270654)
Re:C extensions, portability, and alternative compilers by Maxatar on Monday May 25, 2026 @03:53PM (#48270909)
That's a good point, the more precise statement is that Linux exclusively uses gnu11 to compile.

Clang happens to implement gnu11, I think it's the only non-GCC compiler to do so.

Re:C extensions, portability, and alternative compilers by pjmlp on Tuesday May 26, 2026 @02:44AM (#48275944)
Which was largely sponsored by Google, as they removed GCC from Android, and needed to have clang compile the Linux kernel.

For a long time only Android Linux kernel downstream supported it.

Re:C extensions, portability, and alternative compilers by einpoklum on Monday May 25, 2026 @05:47PM (#48272369)
Yes, sorry, mistype, that should have been "single kind of machine" or "single operating system".