ID Number: Q62703
6.00 | 6.00
MS-DOS | OS/2
buglist6.00 fixlist6.00a
Summary:
The Microsoft C Compiler version 6.0 may produce incorrect results
with old style (K&R) function definitions.
The sample code below illustrates this problem. The program should
print out "ABCDEF". However, if compiled with default optimizations,
it prints out "ACEGIK" in small model and " TLr" in large model. This
is corrected by turning off optimizations or converting the program to
the ANSI style.
Microsoft has confirmed this to be a problem in C version 6.0. This
problem was corrected in C version 6.0a.
Sample Code
-----------
/* Compile options needed: none
*/
#define NULL ((char *) 0)
int var;
int *my_prog_var_table[] = {&var,&var,&var,&var,&var,&var,NULL};
char my_prog_suffix_table[] = "ABCDEFGHIJKLMNOP";
main()
{
printf("Program should print \"ABCDEF\"\n");
my_prog_init_files(my_prog_var_table,my_prog_suffix_table);
printf("\n");
}
// #pragma optimize("tc",off) //Will Fix
my_prog_init_files(vars, suffix)
int *vars[];
char suffix[];
{
int i;
for (i = 0; vars[i]; i++)
{
my_prog_init_file(vars[i], suffix[i])
}
}
// #pragma optimize("tc",on) //Will Fix
my_prog_init_file(var, suffix)
int *var;
char suffix;
{
printf("%c", suffix);
}
Additional reference words: 6.00 6.00a