Path: utzoo!attcan!uunet!timbuk!cs.umn.edu!ub.d.umn.edu!rutgers!rochester!kodak!sisd!jeh From: jeh@sisd.kodak.com (Ed Hanway) Newsgroups: comp.sys.amiga.tech Subject: Re: C compilers code generation Message-ID: <1990Nov19.130657.19380@sisd.kodak.com> Date: 19 Nov 90 13:06:57 GMT References: <1990Nov15.170810.5868@sisd.kodak.com> Sender: news@sisd.kodak.com Organization: Printer Products Division Eastman Kodak Lines: 29 dillon@overload.Berkeley.CA.US (Matthew Dillon) writes: > Uh, I NEVER use strlen() on a string constant. That's the most > ridiculous thing I've ever heard of in my life! > > I use (sizeof("string-constant") - 1). And, if you are worried about > things looking 'neat', simply write a little preprocessor macro to do > it. I'd never use strlen("constant") either, unless I knew that it was evaluated at compile time. I have used (albeit in a toy program): #define SAY(s) Write(backstdout, s, strlen(s)) which works for both SAY("const") and SAY(var). > ... Of course, there are many, many > optimizations that *do* do major good things, but a small plethora of > 'built in' functions is not one of them. Really a huge waste of time; > As far as I can, lattice would have spent their time better on other > optimizations. I tend to agree that builtin functions _by themselves_ are not much good, but in combination with a good optimizer I think that they are worthwhile, at the very least because arguments wouldn't need to be stuffed into specific registers for the function call. -- Ed Hanway --- uunet!sisd!jeh Must be 18 or older to play. Prerecorded for this time zone. Do not read while operating a motor vehicle or heavy equipment.