Re: Hellp with type promotion
- From: "A. Sinan Unur" <1usa@xxxxxxxxxxxxxxxxxxx>
- Date: Tue, 28 Feb 2006 16:58:01 GMT
"Robin Haigh" <ecl6rsh@xxxxxxxxxxx> wrote in news:du1qg6$7jd$1
@newsg3.svr.pol.co.uk:
<manochavishal@xxxxxxxxx> wrote in message
news:1141134465.963604.87530@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
....void test();
....void test(c)
{
printf("size in func %d",sizeof(c));
}
But here's the odd thing. If you change the call
test(c);
to
test();
so that you don't pass an argument at all, you still get the same
output
How is that odd? (Except that the code looks like it is from the 80s).
You have circumvented the prototype system. When func is called, it is
set up to receive one int argument. The value might be crap, but that
doesn't really matter because sizeof does not evaluate its operand.
Of course, IMHO, anyone who writes code like this in this day and age
deserves whatever they get.
Sinan
--
A. Sinan Unur <1usa@xxxxxxxxxxxxxxxxxxx>
(reverse each component and remove .invalid for email address)
.
- References:
- Hellp with type promotion
- From: manochavishal@xxxxxxxxx
- Re: Hellp with type promotion
- From: Ravi Uday
- Re: Hellp with type promotion
- From: manochavishal@xxxxxxxxx
- Re: Hellp with type promotion
- From: Robin Haigh
- Hellp with type promotion
- Prev by Date: Re: Way for computing random primes in standard C.
- Next by Date: Re: Writing Data to Bit Field
- Previous by thread: Re: Hellp with type promotion
- Next by thread: Re: Hellp with type promotion
- Index(es):