Is this a Standard Portable C Program?

C

CBFalconer

Citizen said:
#include <stdio.h>
#define p printf
#define r0 return 0;
#define P int main(void)\
{\
p("Hello world! NULL is %p\n", (void*)NULL);\
r0\
}
P

PLONK.
 
J

jameskuyper

Assuming that those two compilers will compile code for the two
machines in question, you're contradicting yourself. If it is accepted
by the two compilers, how is not portable to the two machines?

Presumably the code is supposed to perform some task; it is portable
if it performs essentially the same task on both machines (in some
cases, the task that should be performed is different on different
machines, which complicates the issue - that's the reason I use the
word "essentially"). If that's not what "portable" means to you, then
there's no problem.

The code could be correctly written to perform that task by relying
upon guarantees provided by the C standard. it could also be written
to have behavior that is undefined by the C standard, so long as it is
correctly written to perform that task by relying upon guarantees
provided by the documentation of both compilers.

However, you're in trouble if your code relies upon a guarantee that
is provided neither by the standard nor by the documentation for a
given compiler. When compiled by that compiler, the fact that the code
has been accepted gives you no indication, one way or another, about
whether or not it will perform the task it was intended to perform.
 
C

CBFalconer

Keith said:
If the program invokes undefined behavior, it might be accepted by
the two compilers, and then appear to work properly until it fails
catastrophically at, for example, the next leap second.

And the manner of failing can be violently different on the two
machines.
 
S

saul.plonkerton

You sick bastard; please, keep your private parts far away from the kids
man! Wow.

You sick bastard; please, keep your private parts far away from the kids
man! Wow.

han! check it out, i trolled Chris Thomasson!

beat that, mutha fugga!

who's the master troll now? hm?
 
V

vippstar

[31 lines deleted]



Chris, what is the purpose of quoting and re-quoting an offensive
article?

Chris M. Thomasson is a troll, or at least I suspect so for some time
now. See, for example, my message here:
Message-ID:
<[email protected]>

When I read that message again I realize I had used the snip feature
wrongly.
I think it implies that Chris said things that I considered as 'troll'
and snipped, when what I had done is snip the whole post of another
troll which Chris M. Thomasson replied to.
 
K

Keith Thompson

[31 lines deleted]



Chris, what is the purpose of quoting and re-quoting an offensive
article?

Chris M. Thomasson is a troll, or at least I suspect so for some time
now. See, for example, my message here:
Message-ID:
<[email protected]>

When I read that message again I realize I had used the snip feature
wrongly.
I think it implies that Chris said things that I considered as 'troll'
and snipped, when what I had done is snip the whole post of another
troll which Chris M. Thomasson replied to.

A quick perusal of Chris's posting history doesn't indicate (to me, at
least) that he's a troll.
 

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,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top