Size of Arguments

Mikey jeffdbREMOVETHIS@netzone.com
Thu Sep 18 17:05:00 GMT 1997


Sorry, longs are 4 bytes just like ints (except on alpha ;^),
my point was that calling parameters are DWORD aligned on the stack
here is the actual code first the C, then the assembler.
Double, and Long Double are NOT the same.
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <float.h>
#include <stdio.h>
int main(){
unsigned char one = CHAR_MAX;
unsigned short two = SHRT_MAX;
unsigned int three = INT_MAX;
unsigned long four = LONG_MAX;
unsigned long long int five = LONG_LONG_MAX;
float six = FLT_MAX;
double seven = DBL_MAX;
long double eight = LDBL_MAX;
char *nine;
nine = &one;
printf("char %d, short %d, int %d, long %d, long long %d, float %d, double %d lo
ng double %d char_ptr %d\n", one, two, three, four, five, six, seven, eight, nin
e);
	movb 127,ドル-1(%ebp)		u_char
.stabn 68,0,12,.LM3-_main
.LM3:
	movw 32767,ドル-4(%ebp)		u_short
.stabn 68,0,13,.LM4-_main
.LM4:
	movl 2147483647,ドル-8(%ebp)	u_int
.stabn 68,0,14,.LM5-_main
.LM5:
	movl 2147483647,ドル-12(%ebp)	u_long
.stabn 68,0,15,.LM6-_main
.LM6:
	movl $-1,-20(%ebp)
	movl 2147483647,ドル-16(%ebp)	u_long_long (int64)
.stabn 68,0,16,.LM7-_main
.LM7:
	movl 2139095039,ドル-24(%ebp)	float
.stabn 68,0,17,.LM8-_main
.LM8:
	movl $-1,-32(%ebp)
	movl 2146435071,ドル-28(%ebp)	double
.stabn 68,0,18,.LM9-_main
.LM9:
	movl $-2132,-44(%ebp)
	movl $-1,-40(%ebp)
	movl 17406,ドル-36(%ebp)		long double
.stabn 68,0,20,.LM10-_main
.LM10:
	leal -1(%ebp),%edx
	movl %edx,-48(%ebp)		pointer_to_char
.stabn 68,0,22,.LM11-_main
.LM11:
	movl -48(%ebp),%eax
	pushl %eax
<<<<<< pointer above		4
	pushl -36(%ebp)
	pushl -40(%ebp)
	pushl -44(%ebp)
<<<<<< long double above	12
	pushl -28(%ebp)
	pushl -32(%ebp)
<<<<<< double above		8
	flds -24(%ebp)
	subl 8,ドル%esp
	fstpl (%esp)
<<<<<< float above passed in 387 reg	8 on stack
	pushl -16(%ebp)
	pushl -20(%ebp)
<<<<<< long long above		8
	movl -12(%ebp),%eax
	pushl %eax
<<<<<< long above		4
	movl -8(%ebp),%eax
	pushl %eax
<<<<<< int above		4
	movzwl -4(%ebp),%eax
	pushl %eax
<<<<<< short above		4
	movzbl -1(%ebp),%eax
	pushl %eax
<<<<<< char above		4
	pushl $LC0
	call _printf
	addl 60,ドル%esp
(jeffdbREMOVETHIS@netzone.com)
delete REMOVETHIS from the above to reply
 Mikey
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


More information about the Cygwin mailing list

AltStyle によって変換されたページ (->オリジナル) /