Hallvard B Furuseth said:
Keith said:
Hallvard B Furuseth said:
C has a standard which defines the offical language. Fine. But as for
"C", as a word, as something to discuss for programming: Well, a C
program is something which is intended to be accepted by a C compiler, I
guess. I.e. this is a C program:
void main() {}
It's a C program which uses a compiler extension which should be
taken out and shot, but still a C program.
[...]
It's a "conforming program" as defined in C99 4p7:
It is? OK, make that
__attribute__((pure)) int main() {return 0;}
then (a GCC extension, if it makes my point easier to understand.
That's also a "conforming program", as far as I can tell, assuming
that (a) it's acceptable to gcc, and (b) gcc is a conforming
implementation. The standard's definition of "conforming program" is
specifically intended to allow for the use of extensions.
C99 4p6:
[...]
A conforming implementation may have extensions (including
additional library functions), provided they do not alter the
behavior of any strictly conforming program.
C99 4p7:
A _conforming program_ is one that is acceptable to a conforming
implementation.
with a footnote:
Strictly conforming programs are intended to be maximally portable
among conforming implementations. Conforming programs may depend
upon nonportable features of a conforming implementation.
My point is that the term "conforming program" is, IMHO, too broad to
be particularly useful. There should be a category of programs that
are acceptable to all possible conforming implementations without
necessarily being strictly conforming.
But the whole issue is mired in political requirements, and any
proposal for a change to the standard would likely generate more heat
than light.
But we were talking about, um, (looking back up to the Subject line)
topicality. So, to get back to that, in my opinion, discussion
of the fact that your program above is a "conforming program" is
certainly topical, but a discussion of the specific semantics of
"__attribute__((pure))" would not be. More generally, discussion
of the fact that extensions are allowed, and what form they can
take in a conforming implementation, is topical; discussion of
specific extensions is more appropriate in a system-specific or
compiler-specific newsgroup.
To go back to your earlier example, we can't just say that
"void main()" is invalid, illegal, bad, evil, etc. We have to
acknowledge that an implementation is allowed to support it, but it's
non-portable and there's rarely a good reason to use it in a program
intended for a hosted implementation.