From: alainm AT news DOT RISQ DOT QC DOT CA (Alain Magloire) Subject: Re: strset function Newsgroups: comp.os.msdos.djgpp References: <1e1batd DOT 137nbir1xiefqN AT d249 DOT paris-48 DOT cybercable DOT fr> <19b54f3c DOT 0c6b504d AT usw-ex0103-019 DOT remarq DOT com> <83r9hr8lr8 DOT fsf AT mercury DOT st DOT hmc DOT edu> X-Newsreader: TIN [version 1.2 PL2] Lines: 30 Message-ID: Date: Tue, 16 Nov 1999 00:59:17 GMT NNTP-Posting-Host: 132.206.63.174 X-Complaints-To: abuse AT mcgill DOT ca X-Trace: carnaval.risq.qc.ca 942713957 132.206.63.174 (Mon, 15 Nov 1999 19:59:17 EST) NNTP-Posting-Date: Mon, 15 Nov 1999 19:59:17 EST To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Nate Eldredge (neldredge AT hmc DOT edu) wrote: : alainm AT news DOT mcgill DOT ca (Alain Magloire) writes: : > Malcolm (donald DOT mcleanNOdoSPAM AT talk21 DOT com DOT invalid) wrote: : > : What does strset do ? I imagine it sets a string to all one : > : character. This is easy to code : > : > Then, in that case you are better off with memset() which on most : > OS/libc coded in assembly for speed. : Not necessarily-- if you don't know the length of the string, you'd : have to do `memset(s, 'X', strlen(s))', which requires making two : passes over the string and could end up being slower. Hum .. I don't want to get involve in that sort of overkill optimization. I have no idea what strset() is , my point was just to prefer mem*() API when possible. Donald Knuth said : "Premature Optimization is the Root of All Evil." Thinking you'll get a noticable gain by rewritten parts of lib C funtions on modern CPU, is misleading. Especially for simple things like the above. Of Couse my 0.02$ Canadian -- au revoir, alain ---- Aussi haut que l'on soit assis, on est toujours assis que sur son cul !!!