Non-reentrant code generated by C compiler (reposting)

Arthur David Olson ado at elsie.UUCP
Sat Sep 15 09:09:49 AEST 1984


Let's try for a lint trap that everyone can agree on.
Remove the change given in <1154 at elsie.UUCP>, then install this one:

	ed /usr/src/cmd/lint/lint.c
	/cfp =/a
	#ifndef OLDVERSION
		if (pflag && cfp->stype == (FTN | STRTY)) {
			werror("struct return reentrancy varies among systems");
			werror("pre-Version-7 systems don't do struct returns");
		}
	#endif
	.
	w
	q

Perhaps the long run thing to do is change "lint" so that you can ask
for different degrees of portability checking.  "lint -P V.2", "lint -P V",
"lint -P III", "lint -P 7", "lint -P 6", "lint -P 5"...?

Another thing we can is to call software "V7-portable" rather than "portable"
when the former label is more accurate.

And by way of explanation. . .I was working on a PDP 11/40 when Version 7 was
released.  And was horrified to learn that Bell Labs was abandoning support
of 11/40's (UNIX had grown too large to fit in their address space).  So for
years after other folks had converted to Version 7, I worked in a Version 6
environment.  Whence my (over-?)sensitivity to the plight of Version 6 folk.

Finally--

> There's nothing unportable about structure returns if your code doesn't
> need reentrancy, which is true of 95% of all C programs at least.

Clearly I believe it's worth trying to catch the 5%.  Then again, I'm
risk-averse:  I'd be loathe to take an airline flight if I had a 95% chance of
surviving.
--
UNIX is an AT&T Bell Laboratories trademark.
--
	...decvax!seismo!umcp-cs!elsie!ado	(301) 496-5688
	(DEC, VAX and Elsie are Digital Equipment Corp. and Borden's trademarks)



More information about the Comp.lang.c mailing list