Whay is a C compiler ANSI compatible?

Sep 11, 2007 25 Replies

that

compiler?

I didn't interpret it that way since none of the standards say anything about the generated output of the compiler.

Correct -- as it is with all programming language standards.

You can expect to get a result of 2 if you say 1 + 1.

The size of data types is a well-known area of implementation-defined behavior.

that

compiler?

but what about:

unsigned char x = 255; x++;

The standard specifies that unsigned char rolls over when it reaches maximum but 255 isn't necessarily maximum. Here both 0 and 256 are valid outputs.

there are a number of very good reasons, the mythical "well defined interfaces" requires knowledge of future products, results in very large complex code to handle all the different types of interfaces, increases testing costs, size of executable, results in "dead code" which is sometimes not allowable in meet certification requirements etc etc etc

No, he meant what he said, because he was talking about (a && b). Your suggestion doesn't work out for that. It would work for (a || b) instead. If you don't believe me, break out a pen and paper and work out the results for all combinations of a and b being either zero or three.

It OK, I rite compilers. I made goof. No pen and papya needed. :-)

It depends. Is your code "ANSI compatible"?

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required