[net.lang.c] return expr and Decus-C: let's stop talking about this

kendall@wjh12.UUCP (Sam Kendall) (05/16/84)

For heaven's sake, isn't there something more interesting to talk
about?  How about ... runtime checking?  Or static checking?  Or
radical optimization?  Has anyone made a compiler (or preprocessor)
which will substitute an instruction (or asm statement) for a strcpy,
say?

	Sam Kendall	{allegra,ihnp4,ima,amd70}!wjh12!kendall
	Delft Consulting Corp.	    decvax!genrad!wjh12!kendall

guy@rlgvax.UUCP (Guy Harris) (05/17/84)

> For heaven's sake, isn't there something more interesting to talk
> about?

Hell, yes.  *Anything* would be more interesting to talk about than
religious arguments about the "right" place to put tokens on "paper".
I've seen a wide variety of styles, and most of them are readable.
Only those that aren't readable (i.e., crappy indentation) are deserving
of censure (or even discussion).

> How about ... runtime checking?  Or static checking?  Or
> radical optimization?  Has anyone made a compiler (or preprocessor)
> which will substitute an instruction (or asm statement) for a strcpy,
> say?

Well, you guys wrote a compiler that does the first and/or the second, so
the ball is in your court....  By "radical optimization", do you mean what
a "typical" optimizing compiler does, or something beyond that?  Yes, I
hear some of you out there complaining that you can't write device drivers
for an optimizing compiler.  Well, the problem is that some variables'
behavior can't be determined by dataflow analysis; variables shared between
processes (either in the kernel or in shared segments - as of S5, UNIX actually
has an official implementation of shared data!) have the same problem as
device registers, which are "variables" shared by the CPU and the device.
PL/I had a simple solution; declare the variable "abnormal".  This tells the
compiler that if the variable gets set to "77" in statement N, that the
variable may not have the value "77" in statement N+1.

As for the substitution of instructions for subroutine calls, this is done
more and more with the aid of "sed" scripts; both Bell and Berkeley's
recent distributions do it quite a bit.  They also do substitutions of "text"
for "data" in the assembly output, to move common read-only data like strings
to shared code space.  This crock, at least, may become obsolete soon with
a "const" or "readonly" storage class.  It would be nice if the "asm.sed"s
could also be made obsolete.  Two ways I can think of off the top of my head
are:

	1) tweaking the peephole/final optimizer (C2) to detect certain
	subroutine calls and to substitute assembly code sequences.  The
	simple-minded way is to leave the pushes of the operands there, and
	to have the instruction take its operands off the stack.  A fancier
	way might turn

	movl	#count,-(sp)
	movl	$to,-(sp)
	movl	$from,-(sp)
	calls	#3,_bcopy

	into

	movc3	from,to,#count	# or whatever the VAX-11 syntax is

	which would be trickier.

	2) having a way to specify to the code generator that certain
	"subroutines" are really builtins, and have it generate the
	appropriate instruction.  Of course, one would want to be able to
	shut this off, as you might have a routine called "bcopy" which
	*didn't* copy arg[3] bytes from arg[1] to arg[2] and not want all
	calls to that routine turned into block moves.

	Guy Harris
	{seismo,ihnp4,allegra}!rlgvax!guy

hans@log-hb.UUCP (05/18/84)

For heaven's sake, isn't there something more interesting to talk
about?  How about ... runtime checking?  Or static checking?  Or
radical optimization?  Has anyone made a compiler (or preprocessor)
which will substitute an instruction (or asm statement) for a strcpy,
say?

	Sam Kendall	{allegra,ihnp4,ima,amd70}!wjh12!kendall
	Delft Consulting Corp.	    decvax!genrad!wjh12!kendall
-- 
			{decvax,philabs}!mcvax!enea!log-hb!hans
			Hans Albertsson, 
			TeleLOGIC AB
			Box 1001,
			S-14901 Nynashamn,
			SWEDEN

hans@log-hb.UUCP (05/19/84)

[]
	Terribly sorry, but there were at least 3 spurious
	followups leaving this site a few days ago, on 
	May 17, to be exact, all due to a faulty news-reading program.
	They all consisted of:
	A) A header indicating that it came from me.
	B) The complete body of a message I had just finished reading.
	C) The original signature.
	D) My signature.
	It wasn't me trying to steal other peoples views outright,
	just good old " Manual? Reading? Why?" syndrome....
	Sorry if my incompetence disturbed anyone.
-- 
			{decvax,philabs}!mcvax!enea!log-hb!hans
			Hans Albertsson, 
			TeleLOGIC AB
			Box 1001,
			S-14901 Nynashamn,
			SWEDEN