[net.lang.c] What does the compiler think I am doing here?

joe@emacs.uucp (Joe Chapman) (09/02/85)

<>
[ The discussion concerns putting statements like ``37;'' into your C
code.  I'm addressing the claim that no known compilers will generate
code for this statement. ]

Well, I once worked with a C compiler on a 68000 which interpreted
statements consisting of a single number as 68K code.  It was really
great!  You get stuff which looks like this:

	printf("hello, world!\n");
	i++;
	0x00ff12;
	if (i > 3) {

And so forth.  There was even a kernel include file which declared
spl0 & co. like this:

	#define spl0()	0x0012345

Or whatever it was.

-- 
-- Joseph Chapman                  decvax!cca!emacs!joe
   CCA Uniworks, Inc.              emacs!joe@cca-unix.ARPA
   20 William St.
   Wellesley, MA  02181            (617) 235-2600

rcd@opus.UUCP (Dick Dunn) (09/11/85)

> [ The discussion concerns putting statements like ``37;'' into your C
> code.  I'm addressing the claim that no known compilers will generate
> code for this statement. ]
> 
> Well, I once worked with a C compiler on a 68000 which interpreted
> statements consisting of a single number as 68K code.  It was really
> great!  You get stuff which looks like this:
> ...
> 	0x00ff12;
> ...

Great?  Well, it's cute, but the compiler is dead wrong...it's a pretty
radical change to C's semantics.  (Gee, I wonder if an expression like
"i+j;" would compute the sum, store it, and execute the result?:-)
Seems to me that this little extension could get into a dandy fight with
some obscure macros and a clever optimizer.  Aaaack.

> And so forth.  There was even a kernel include file which declared
> spl0 & co. like this:
> 
> 	#define spl0()	0x0012345
> ...(or whatever)

"And so forth"???  Sounds a bit like Forth, right?!  (but certainly not
forthright...)
-- 
Dick Dunn	{hao,ucbvax,allegra}!nbires!rcd		(303)444-5710 x3086
   ...Relax...don't worry...have a homebrew.