3 ms·
> Sure they do, by definition code that uses the extensions is not standards compliant. I don't follow. How's having non-standard complying code taking advanta
by RamiK 13y ago
> Sure they do, by definition code that uses the extensions is not standards compliant.
I don't follow. How's having non-standard complying code taking advantage of the extensions offered makes the compiler itself any less standard capable? I was under the impression being standard compliant didn't mean forbidding extensions... But I suppose I could have been mistaken. :(
> GNU C is a strict superset of ANSI C...
In the same way that I said "Plan 9's C is a restricted ANSI C variety". Yes. It takes some good stuff from ANSI C and leaves some unnecessary stuff out by default. Still, keeping to the standard.
> some ANSI C things are missing; e.g. const.
Surprisingly irrelevant. The draft actually said "If an attempt is made to modify an object defined with a const-qualified type through use of an lvalue with non-const-qualified type, the behavior is undefined.". So, regardless of what the Plan9 doc says about giving warnings and not implementing const in a standard confirming way, no behavior was ever expected in the first place by the standard so the compiler is unwittingly compliant :D And volatile follows suit...
My guess to why the standard requires to implement a keyword without specifying explicit behavior, is that they wanted backward-compatibility with some vendor compiler that did implement these but didn't want to force any actual functionality.
Mind you the standard is far more lax then most people give it credit: Even "void main()" and "exits(0);" that usually raise a few eyebrows are all implementation-specific according to the standard and thus are compliant.
> The compiler document is very accurate...
I was thinking about https://docs.google.com/document/d/1xN-g6qjjWflecSP08LNgh2uFsKjWb-rR9KA11ip_DIE https://docs.google.com/document/d/1xN-g6qjjWflecSP08LNgh2uF... but I'm obviously not as versed as you in the state of the tool-chain so that's that I suppose.
I personally did some work on getting the compiler to work on a MIPS router I had a few years back but my work was superseded by something better before I could even think about release so that was that... It was at a pretty late stage though with most of the assembly written down. So the impression I got at the time must have had mostly to do with the assembler. But that's ancient history I suppose.
So, from what I can tell out of the standard and the actual behavior of the compiler, it's complaint regardless of what it's docs say. More so, I can't think of a lot of non-confirming compilers I came across outside the embedded circles in recent years. Why, even MSVC is at most a custom header away per project away from compliance and since boiler-plate was never restricted it might as well be considered standard.
TL;DR Standards are highly overrated.