H
Harald van Dijk
It is a "conforming program".
True, though not a "correct program".
It is a "conforming program".
Hey guys, the standard says:
<quote>
A conforming implementation may have extensions (including additional
library functions), provided they do not alter the behavior of any
strictly conforming
program.3)
<end quote>
So, anything that doesn't break the established rules is ALLOWED.
I think that your definition of 'extensions' is broken. If it is in the
C standard, then *by definition* it is *NOT* an extension.
Therefore, use of the offsetof() macro requires nothing whatsoever
beyond standard C.
Think about it, and you will see my point.
Do we agree (then) that use of offsetof() does not require a language
extension?
Yes.
If so, then I do not understand what the issue is.
jacob said:I am "incompetent" as Hans J. Boehm:
"Threads cannot be implemented as Libraries"
Harald said:Yes, that's not the issue. The issue is whether a conforming
implementation may also have non-extensions that cause non-standard code
to be accepted.
Philip said:Harald van Dijk wrote:
I would say unequivocally yes.
pete said:Any extension that won't screw up the translation
and execution of a strictly conforming program, is allowed.
Roughly speaking, any running computer software,
that can translate and execute a strictly conforming C program,
is a conforming C implementation.
CBFalconer said:user923005 wrote: [...]However, I think that a diagnostic should be issued for a
compiler that does something like this:
qfloat foo = 12345678901234567890.9999999Q;
Failure to emit a diagnostic in conformant mode is an indication
that the compiler is broken.
I actually disagree, but at any rate a simple output of "This
compilation accepts non-standard gubris" will suffice. The
standard does not specify quality.
CBFalconer said:user923005 wrote: [...]However, I think that a diagnostic should be issued for a
compiler that does something like this:
qfloat foo = 12345678901234567890.9999999Q;
Failure to emit a diagnostic in conformant mode is an indication
that the compiler is broken.I actually disagree, but at any rate a simple output of "This
compilation accepts non-standard gubris" will suffice. The
standard does not specify quality.
12345678901234567890.9999999Q is a syntax error in standard C. For
that matter, so is qfloat unless it's been declared somewhere
(presumably as a typedef). Diagnostics are required for violations of
syntax rules and of constraints.
So the "123.456Q" syntax is a valid extension (since no strictly
conforming program can use it), but the compiler must still issue a
diagnostic -- which, as you say, can be as simple as "Thank you for
using this wonderful extension".
And of course no diagnostic is required if the compiler is invoked in
a non-conforming mode (but then if the compiler is non-conforming,
then the standard requires absolutely *nothing* of it).
user923005 said:.... snip ...
I want to make it clear (also) that I actually like Jacob's
qfloat extension.
CBFalconer said:That's fine, as an extension. It should require some sort of
operator selection to enable it, without which it should trigger an
error or warning.
user923005 said:I would also like to see 0.5 ULP accuracy guarantees (with valid range
for those accuracies) for all math library functions and arithemetic
operations.
While we are at it, it would also be nice to have interval arithmetic
data type and a native exponentiation operator.
C tends to be more of the "Let's write an operating system" language
with math tossed in as an afterthought.
While that's certainly reasonable for many operations, experts in the
field (which I am not) have told me that it is extraordinarily difficult
to achieve for some of the library functions. Even 1 ULP is challenging
in some cases.
There's already a native exponentiation operator, although it's spelled
a bit funny: pow().
Fred Tydeman has been making a valiant effort to correct that with his
floating point test suite:
<http://www.tybor.com/>
jacob said:It will not work if you do not include
#include <qfloat.h>
That's a quality problem. The failure will not indicate that it is
due to the use of a non-standard extension.
While that's certainly reasonable for many operations,
experts in the field (which I am not)
have told me that it is extraordinarily difficult
to achieve for some of the library functions.
Even 1 ULP is challenging in some cases.
There's already a native exponentiation operator,
although it's spelled a bit funny: pow().
That's one of the tough ones to get accuracy.
Here's my P.J. Plauger quote on that topic:
"We used to do successive multiplication, until we discovered that
accuracy degrades quickly with that approach. The only really
safe way to evaluate pow(x, y) accurately is to compute
exp(y * ln(x)) to extra internal precision. (Took us a lot of
rewrites, and a lot of careful testing, to find that out.) "
http://groups.google.com/group/comp.lang.c/msg/e7cff29955d4971b
While that's certainly reasonable for many operations, experts in the
field (which I am not) have told me that it is extraordinarily difficult
to achieve for some of the library functions. Even 1 ULP is challenging
in some cases.
There's already a native exponentiation operator, although it's spelled
a bit funny: pow().
Fred Tydeman has been making a valiant effort to correct that with his
floating point test suite:
<http://www.tybor.com/>
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.