jacob navia said:
user923005 said:
Keith Thompson wrote: [...]
3) Using operator overloading, I integrated this library
like a basic type into the language.
Where the phrase "the language" refers to something other than C.
No. All this extensions are compatible with the C standard as
I have explained thousand times in this newsgroup.
Note that the C standard does NOT forbid extensions
By the same logic, this is C code, since GCC compiles it:
[snip fortran code]
All extensions and proposals that I have argued over and
over produce always this brainless answers...
BRAVO user923005!
Your arguments show the sophistication your mind is capable of!
Yes, they do, but not in the way you mean. (Once again, *please* stop
trying to use sarcasm; you just don't have the knack.)
It's been stated in this thread that a Fortran program is not actually
accepted by gcc in a mode in which it acts as a conforming C compiler.
But consider a hypothetical compiler that (a) acts as a conforming C
compiler (let's say it's a fully conforming hosted C99
implementation), and (b) also acts as a conforming Fortran compiler.
Unless there are programs that are simultaneously legal C and legal
Fortran, but with different semantics, this is entirely possible. In
fact, it could easily be implemented as a wrapper that invokes a C
compiler for C programs, and a Fortran compiler for Fortran programs.
The handling of the full Fortran language in this manner can be viewed
as an *extension* provided by a conforming C implementation. As long
as this extension does not alter the behavior of any strictly
conforming C program, it's permitted by the standard. Thus, a
conforming C implementation *can* compile Fortran, and user923005 made
a valid point.
Similarly, a conforming C implementation *can* compile a C-like
language that incorporates operator overloading.
Incidentally, I don't believe that a C program can use operator
overloading without violating either a constraint or a syntax rule.
My understanding is that the existence of an extension does not
relieve the compiler of its obligation to issue a diagnostic for any
such program; after issuing the diagnostic, it's then free to go on
and handle the extension as it likes. (Of course, this applies only
in conforming mode; a compiler is perfectly free to *silently* accept
operator loading, or do anything else it likes, in a non-conforming
mode.)
So, in conforming mode, a compiler can either (a) reject the use of
operator overloading, or (b) accept it, but only after issuing a
diagnostic. Failure to issue the diagnostic would be a violation of
the standard.
(This is a fairly subtle argument, and it's possible that I'm
mistaken, but it was the result of a discussion in comp.std.c.)