HELP! What's wrong with my program?

Hong Ye ye at henri.ucsb.edu
Tue Mar 19 03:28:00 AEST 1991


Following piece of code looks to be perfectly innocent. It runs perfectly
on Sun-3 indeed. But it produces weird results on Sun-4 and DEC2100. I
guess the compiler on Sun-4 or DEC uses a different calling convention.

Could anybody tell me what I am doing wrong? Please reply through mail.

#include <stdio.h>

#define	argA	0xAAAAAAAA
#define	argB	0xBBBBBBBB
#define	argC	0xCCCCCCCC

main() {
	printf("Original:\n");
	printf("\t%08X\n\t%08X\n\t%08X\n",argA,argB,argC);
	fake_printf(argA,argB,argC,0);
}	/* main */

fake_printf(args)
int args;
{
	internal_printf(&args);
}	/* fake_printf */

internal_printf(args)
int *args;
{
	printf("Inside Printf:\n");
	while (*args) {
	    printf("\t%08X\n",*args);
	    args++;
	}
}	/* internal_printf */



More information about the Comp.sys.sun mailing list