Direct Pointer assignment

J

Jack Klein

"implementation-defined behaviour" is expected to be consistant --
but it might be consistant with something complex and effectively
beyond your control. And "consistant" does not mean "will not crash".

This is not correct. "implementation-defined" has a very precise
meaning in the standard. The implementation must choose among a
number of alternatives that are superficially permitted by the
standard, and it must document its choice.

Examples of implementation-defined behavior include:

-- whether right shifting a signed int with a negative value preserves
the sign bit in the result

-- what happens when you assign a signed int value outside the range
of signed char to signed char

Implementation-defined is never allowed to be undefined, or directly
cause undefined behavior.

The other term that causes confusion is "unspecified" behavior, which
again is not the same as undefined. Here the implementation is
required to choose among a number of alternatives allowed by the
standard, but is not required to document its choice and is not
required to be consistent in its choice.

The classic example is the order of evaluation of function arguments.
All the arguments must be evaluated prior to the actual function call,
but the order is unspecified. There's a good reason for it being
unspecified, rather than implementation-defined. Some implementations
use a more efficient method of passing arguments to "ordinary"
functions than they are able to use for variadic functions. This
difference in argument passing methods might cause a difference in
order of evaluation.
 
E

ena8t8si

Walter said:
There -are- portable tests you can use to figure out whether
a particular integral type is two's complement, one's complement,
or signed magnitude.

How does that work without knowing where the padding
bits are?
 

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

No members online now.

Forum statistics

Threads
474,264
Messages
2,571,065
Members
48,770
Latest member
ElysaD

Latest Threads

Top