Mail Archives: djgpp/1996/04/09/21:59:52
Date: | Tue, 9 Apr 1996 21:52:25 -0400
|
From: | dj (DJ Delorie)
|
Message-Id: | <199604100152.VAA18072@delorie.com>
|
To: | Jetman AT gnn DOT com
|
CC: | djgpp AT delorie DOT com
|
In-reply-to: | <199604091541.LAA31790@mail-e2b-service.gnn.com> (message from Jethro Wright on Tue, 09 Apr 1996 11:46:44)
|
Subject: | Re: A Proper Cast for a Funtion Ptr....
|
Even in ANSI C, a function type cast may change the way values are
passed on the stack. If and ANSI C function declares that it takes a
"short" or a "long", and you pass it the other type, the compiler is
allowed to perform an implicit type conversion when it codes a call to
that function. For example, if you have a function that takes two
ints:
void foo(int x, int y);
and you cast it to a function that takes two "long long"s:
void foo(long long x, long long y);
the compiler will push 16 bytes (two 8-byte long-longs) instead of the
8 bytes (two ints) that the function is really expecting.
DJ
- Raw text -