Path: utzoo!attcan!uunet!nuchat!sugar!peter From: peter@sugar.UUCP (Peter da Silva) Newsgroups: comp.sys.amiga Subject: Re: In-line assembly in Lattice C Message-ID: <2171@sugar.UUCP> Date: 25 Jun 88 01:42:45 GMT References: <5841@bloom-beacon.MIT.EDU> <558@sas.UUCP> <6361@well.UUCP> Organization: Sugar Land UNIX - Houston, TX Lines: 49 In article <6361@well.UUCP>, ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) writes: [ no self-respecting programmer would write ] > strlen ("abcdefg"); > But would instead use (if he really *had* to): > sizeof ("abcdefg") - 1; Once upon a time, getting a library working for the Small 'C' compiler, I wrote: #define prints(s) write(1, s, strlen(s)) prints("abcdefg"); Of course, this was *not* a situation where performance was important. > If the code is written by d*psh*ts, it is *not* the responsibility > of the compiler vendor to save their butts. When you have hundreds of programmers working on a system, some of them (maybe most of them) are going to be dopshots. > me what it *does*!). Enforced parenthetical grouping whether or not it's > necessary is Stupid. Making string constants read-only is Stupid. Breaking > all the string functions and giving them cryptic names is Stupid. You know, I really don't disagree with any of this stuff... I just think that there is *no* construct that's so loony that it's not going to be useful sometime. For example, see Ken Arnold's character-to-printable-string macro that I think was in an early version of curses.h. I can't remember it exactly, but it's got stuff in it like: #define ctrl(c) \ (((c)<' ')?("^"[1]=(c)+'@',""[-2]):(((c)>'~')?"^?":(""[0]=(c),""[-1]))) It actually generated "M-^X" as well. I think you can see how it works. ANSI definitely breaks *this* one. > If K&R gets stampeded over by An-C, I'm gonna go pure assembler. At > least they won't be able to screw *that* up. See discussions of optimising RISC assemblers in comp.arch. -- -- `-_-' Peter (have you hugged your wolf today?) da Silva. -- U Mail to ...!uunet!sugar!peter, flames to /dev/null. -- "A foolish consistancy is the hobgoblin of little minds".