Re: is order urgent doubt
- From: new to c <non@xxxxxxxxxxxx>
- Date: Mon, 2 Jun 2008 00:11:47 +0200 (CEST)
Keith Thompson wrote:
new to c <non@xxxxxxxxxxxx> writes:
I write the 2 codes
int i;
i = sizeof(long int);
printf("%i", i);
i = sizeof(int long);
printf("%i", i);
and the first code and second code print 4.
Right. It won't necessarily be 4 on all systems, but both are
equivalent.
However, "int long" is very non-idiomatic. The compiler can handle it
with no problem, but human readers are going to stumble over it.
(Please ignore the long flame war that will now begin claiming that
anyone who knows C should be able to read "int long" without any
trouble. The fact that the C standard allows variations in the order
of the keywords is fairly obscure; a member of the standard committee
recently posted here saying he didn't even know about it.)
I write another 2 codes
i = sizeof(double int);
printf("%i", i);
i = sizeof(int double);
printf("%i", i);
and the first code print 4 and the second code print 8.
That's surprising. Your compiler should have rejected it, or at least
warned you about it. Are you sure that's *exactly* what you wrote?
He warn "multiple use of int" on first code and "multiple use of double"
on second code but I think is bogus......only one int in first code and
only one double in second code.
I write big international program and need double integer. Why size is
different when other order?
.
- Follow-Ups:
- Re: is order urgent doubt
- From: Bartc
- Re: is order urgent doubt
- From: Eric Sosman
- Re: is order urgent doubt
- References:
- is order urgent doubt
- From: new to c
- Re: is order urgent doubt
- From: Keith Thompson
- is order urgent doubt
- Prev by Date: Re: How to print an array of char backward.
- Next by Date: Re: is order urgent doubt
- Previous by thread: Re: is order urgent doubt
- Next by thread: Re: is order urgent doubt
- Index(es):
Relevant Pages
|