casting

J

jaysome

The definition changed between C90 and C99 (and again between C99 and
N1124).

C90 3.10:
implementation-defined behavior: Behavior. for a correct program
construct and correct data, that depends on the characteristics of
the implementation and that each implementation shall document.

C90 3.17:
unspecified behavior: Behavior, for a correct program construct
and correct data, for which this International Standard explicitly
imposes no requirements.

C99 3.4.1:
implementation-defined behavior

unspecified behavior where each implementation documents how the
choice is made

EXAMPLE An example of implementation-defined behavior is the
propagation of the high-order bit when a signed integer is
shifted right.

C99 3.4.4:
unspecified behavior

behavior where this International Standard provides two or more
possibilities and imposes no further requirements on which is
chosen in any instance

EXAMPLE An example of unspecified behavior is the order in which
the arguments to a function are evaluated.

(The definition of "unspecified behavior" was tweaked slightly in
N1124; the revised definition is "use of an unspecified value, or
other behavior where ...".)

C99 5.1.2.2.1 allows main() to be defined in either of the traditional
ways "or in some other implementation-defined manner". But this
doesn't use the term "implementation-defined behavior", which is
defined in section 3. The standard doesn't provide a definition of
"implementation-defined" other than in the context of
"implementation-defined behavior" or "implementation-defined value",
so I think we just have to read it as ordinary English text; "some
other implementation-defined manner" simply means "some other manner
which is defined (i.e., documented) by the implementation". For
implementation-defined *behavior*, the standard must provide two or
more possibilities; for implementation-defined anything-else, it
needn't do so.


Which is exactly what "conforming" means.

A *conforming program* is one that is acceptable to a conforming
implementation.

If I wrote a conforming implementation that allows
struct {char c; long double x;}main(void) {}
then that would become a conforming program. (The concept of a
"conforming program" isn't all that useful.)

I think a conforming program may be more useful than you think. Your
example of a conforming main() might not be so useful, but other
aspects of a conforming program can definitely be useful. That's what
the C Standard allows.

I prefer a conforming implementation to a non-conforming one. And if
my conforming implementation tells me through documentation that I
need to define main() as:

struct {char c; long double x;}main(void) {}

and that I need to set c to my favorite character and set x to the
average price of a pound of baloney in the Salt Lake City region on
the third day of the month, averaged over the past year, then, by God,
I'll do that to get my ZOG 32-bit DSP--where sizeof(char) ==
sizeof(long)--working and appease my boss and collect a well-deserved
paycheck. And I'll have the added comfort knowing that I am
programming in Standard C.
 
R

Richard Heathfield

Keith Thompson said:
Which is exactly what "conforming" means.

Yes, but my point is that the /same/ code can and often will become
non-conforming when submitted to a different implementation.
A *conforming program* is one that is acceptable to a conforming
implementation.

If I wrote a conforming implementation that allows
struct {char c; long double x;}main(void) {}
then that would become a conforming program. (The concept of a
"conforming program" isn't all that useful.)

We do have a slightly more useful concept available to us, however, which
was mooted here some years ago - that of "a comp.lang.c-conforming
program", which is defined as follows: "a program is acceptable to
comp.lang.c if and only if it is acceptable to comp.lang.c."

I find this concept to be much more relevant here in comp.lang.c than the
concepts "conforming program" and "strictly conforming program".
 
R

Richard Heathfield

jaysome said:

And if
my conforming implementation tells me through documentation that I
need to define main() as:

struct {char c; long double x;}main(void) {}

....then it is a freestanding implementation.
 
P

pete

Richard said:
Keith Thompson said:


We do have a slightly more useful concept available to us,
however, which
was mooted here some years ago - that of "a comp.lang.c-conforming
program", which is defined as follows: "a program is acceptable to
comp.lang.c if and only if it is acceptable to comp.lang.c."

I find this concept to be much more relevant here
in comp.lang.c than the
concepts "conforming program" and "strictly conforming program".

A "correct program" is acceptable to me on this newsgroup.
 

Ask a Question

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.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,191
Latest member
BuyKetoBeez

Latest Threads

Top