From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sam To: <9fans@cse.psu.edu> Subject: Re: [9fans] how to avoid a memset() optimization In-Reply-To: <3DD35C73.8090404@null.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Date: Thu, 14 Nov 2002 08:20:24 -0500 Topicbox-Message-UUID: 1f1e2592-eacb-11e9-9e20-41e7f4b1d025 > Do you really want the compiler to always generate code > MOV R1,#0 > MOV R2,#0 > AND R2,R1 > MOV R2,X(SP) Yes, yes, and yes. Optimizations which intelligently manage register allocation are about as far as *I* appreciate. Do precisely what I say, and no less. If I write poor code, boo hoo for me. Heavily optimizing compilers will *never* make all coders equal and generally cause more headaches than they're worth. I do appreciate some warnings (ie if I forget to initialize a variable to zero before I use it), but some of them are just irritating. Brantley looked over my shoulder a while back and wondered why I was typing: if((m=fn())) { ... } saying, "what's with the extra parenthesis?" "Oh, gcc complains that I should surround assignment values used as a truth statement and I've just incorporated it by habit to shut it up." I hadn't even realized I was permitting gcc to define my style. In essence, by permitting mad optimizations and then having to do backflips just to keep the compiler from optimizing away our real intentions, we're doing the same thing. I hardly see this as useful. Cheers, Sam