4 ms·
This is not a C compiler; the language it accepts bears only a superficial resemblance to any version (formally standardized or not) of C. The subset of C's or
by fredkbloggs 11y ago
This is not a C compiler; the language it accepts bears only a superficial resemblance to any version (formally standardized or not) of C. The subset of C's original authors responsible for this needed to accept that C was both (a) extremely popular and successful and (b) to their way of thinking, inferior to what they would have wished. That's a tough place to be, but denial is worse.
- vezzy-fnord 11y agoWhy did they need to accept any of that? They were doing a clean-room implementation, and mostly ANSI C-compatible with a significantly simplified preprocessor. Theo de Raadt considered using it for OpenBSD at the turn of the 21st century, but backed out over licensing. I have no idea what angle you're getting at here.
- f2f 11y agoback when the plan9 compilers were introduced to the world [0] POSIX 1003 was less than 3 years old. that they didn't change much in their design since is a testament to a) how good they were and 2) how good their authors were. -- 0: ftp://nic.funet.fi/pub/OS/plan9/doc/plan-9-docs/dist.ps.Z
- fredkbloggs 11y agoOr it could be a testament to how little real-world use Plan 9 saw. This is the same reason Latin doesn't change.
- f2f 11y agoyes, that too :)
- stonogo 11y agoIs there a particular reason that "using a subset of ANSI C" is morally worse than "inventing an entirely new language"? I think you're maybe ascribing some kind of ethical purity to ANSI that it doesn't really have, especially given the popularity of GNU extensions et al.
- fredkbloggs 11y agoI'm drawing a distinction between adding extensions (which can still be problematic if they can't be disabled) and ignoring or rejecting parts of the language that are required for correctness. The simplest and most obvious example mentioned fairly early in the paper is const but there are plenty of others. I can compile nearly any C program using gcc and get correct behavior. Obviously I can also compile a lot of other things using gcc, including things that are not found in C, and if I do so then I cannot expect any definition of C to specify the resulting behavior. But most C programs will not compile using the Plan 9 compilers at all, because they do not accept the C language by any meaningful definition. In the case of const, it's also true that many dangerously incorrect programs will compile when using Plan 9's compiler, even though any definition of C prohibits that explicitly. These are qualitative differences. Let's be even more concrete. In case 1, we consider a language exactly like C (pick whatever C you want here), but with the following additional preprocessor symbols always defined: #define _FBEGIN { #define _FEND } This language allows, but does not require, the use of alternate tokens instead of { and } around function bodies. Because the tokens are taken from a namespace reserved by the standards, every correct C program is also a correct program in this language, and will have the same behavior. I submit that one may reasonably claim that a compiler for this language is a C compiler that supports extensions, even though a very limited subset of incorrect programs will fail to compile in a different way than they would when submitted to a C compiler. In case 2, we consider the same language except that in this case the use of { and } around function bodies is not accepted. Instead, one must use _FBEGIN and _FEND. I submit that a compiler for this language is not a C compiler, as no (useful) correct C program is accepted by it. What the Plan 9 compiler authors did, repeatedly, reduces to case 2. There is nothing unethical about creating a new language. There is something unethical about creating a new language and not only deliberately giving it the same name as a similar (very popular) language, but disingenuously acting as if it were that language. At best, the implication that all other (again, very popular) standards and implementations of C are wrong simply for not being Plan 9's is obnoxiously smug.
- vezzy-fnord 11y agoYour entire rant is protracted and without substance. It boils down to comparing 9c to gcc and concluding that the former is not a C compiler relative to the standards of the latter. In which case, tcc, pcc and ACK would also be disqualified as C compilers under your definition.