🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2760

Unspecified, not undefined

#2760
From: Roy Johnson
Date: Wed, 17 Apr 1991 15:28
37 lines
1099 bytes
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
Technical Details
Message-ID: <RJOHNSON.91Apr17102824@olorin.shell.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!dimacs.rutgers.edu!bcm!shell!shell!rjohnson

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!dimacs.rutgers.edu!bcm!shell!shell!rjohnson
From: rjohnson@shell.com (Roy Johnson)
Newsgroups: comp.std.c
Subject: Unspecified, not undefined
Message-ID: <RJOHNSON.91Apr17102824@olorin.shell.com>
Date: 17 Apr 91 15:28:24 GMT
Sender: usenet@shell.shell.com (USENET News System)
Distribution: comp
Organization: Shell Development Company, Bellaire Research Center, Houston, TX
Lines: 37