Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!cornell!uw-beaver!mit-eddie!killer!gtmvax!dms3b1!dave
From: dave@dms3b1.UUCP (Dave Hanna)
Newsgroups: comp.sys.amiga
Subject: Re: In-line assembly in Lattice C
Summary: You can bust anything if you try hard enough.
Message-ID: <120@dms3b1.UUCP>
Date: 29 Jun 88 02:16:09 GMT
References: <5841@bloom-beacon.MIT.EDU> <558@sas.UUCP> <6361@well.UUCP>
Organization: Daltech MicroSystems, Dallas
Lines: 41

In article <6361@well.UUCP>, ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) writes:
> In article <558@sas.UUCP> toebes@sas.UUCP (John Toebes) writes:
> >Lattice C does not support in-line assembly.  It does however support builtin
> >functions which generate inline code for many of the common C functions.
> >For example:
> >    strlen("abcdefg")
> >Is reduced to a single move instruction of a constant value.
> >
> NOTE		NOTE		NOTE		NOTE		NOTE
> flame {
> 
> 	Still trying to save the stupid programmers from themselves, eh
> John :-)?
> 
> 	You realize, of course, that this kind of optimization falls flat on
> its face if I somehow manage to change the contents of the memory that
> contains "abcdefg".  I could stuff a \0 where the 'd' is, and the program
> would not notice. 

Now wait a minute, Leo.  Let me say that I have nothing but respect
for you and the work you've done, but that argument is no more valid
than saying that the compiler is broken because it can't guarantee
the validity of the code it generates for "i = 1;" because
I might modify the memory location that contains the constant 1.
You can break it if you try hard enough, but a compiler has to be
able to assume that a constant is going to stay a constant, and
"abcdefg" is a string constant.

(As a post script, I once spent the better part of a week debugging
a program for a guy that swore our FORTRAN compiler was busted.  In
fact, he had found a way to modify the constant 0!)

> Leo L. Schwab -- The Guy in The Cape  ihnp4!pacbell -\

	Dave Hanna

-- 
Dave Hanna,  Daltech MicroSystems    |  "Do or do not -- There is no try"
P.O. Box 584, Bedford, TX 76095      |                        - Yoda
(214) 358-4534   (817) 540-1524      |
UUCP:  ...!killer!gtmvax!dave        |