S
Sidney Cadot
Hi all,
In a discussion with Tak-Shing Chan the question came up whether the
as-if rule can cover I/O functions. Basically, he maintains it can, and
I think it doesn't.
Consider two programs:
/*** a.c ***/
#include <stdio.h>
int main(void)
{
fopen("somefile","rb");
return 0;
}
/*** b.c ***/
in main(void)
{
return 0;
}
Would it be legal for a compiler (through optimization), to emit the
same code for program a.c and b.c ?
I'd welcome a reference from the standard.
Best regards,
Sidney
In a discussion with Tak-Shing Chan the question came up whether the
as-if rule can cover I/O functions. Basically, he maintains it can, and
I think it doesn't.
Consider two programs:
/*** a.c ***/
#include <stdio.h>
int main(void)
{
fopen("somefile","rb");
return 0;
}
/*** b.c ***/
in main(void)
{
return 0;
}
Would it be legal for a compiler (through optimization), to emit the
same code for program a.c and b.c ?
I'd welcome a reference from the standard.
Best regards,
Sidney