Unspecified, not undefined

Roy Johnson rjohnson at shell.com
Thu Apr 18 01:28:24 AEST 1991


One more shot at this "problem":

int v=1;

int return_v() {
  return v;
}

int main() {
  printf("v=%d, v=%d\n", v++, return_v());
  return 0;
}

it prints
	v=1, v=1
under Sun cc, and
	v=1, v=2
under GNU cc.

Or how about using aliasing:

int main() {
  int v=1, *pv=&v;

  printf("v=%d, v=%d", v++, *pv);
  return 0;
}

which prints
	v=1, v=2
under both compilers?

Just beating a dead horse...
--
=============== !You!can't!get!here!from!there!rjohnson ===============
Feel free to correct me, but don't preface your correction with "BZZT!"
Roy Johnson, Shell Development Company



More information about the Comp.std.c mailing list