From: Radical DOT NetSurfer AT delorie DOT com Newsgroups: comp.os.msdos.djgpp Subject: Re: Please add strrev proposal Date: Sat, 29 Sep 2001 00:32:11 -0400 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <9ljart04o115f88rkara1m09u5vctv484i@4ax.com> References: <3BB50884 DOT 347A4384 AT yahoo DOT com> X-Newsreader: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: newsabuse AT supernews DOT com Lines: 41 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com What ever happened to the earlier comment... anyway, i think this is going to be my last post on the topic. sinan. -- -------------------------------- A. Sinan Unur http://www.unur.com/ On 29 Sep 2001 01:00:32 GMT, "A. Sinan Unur" wrote: >CBFalconer wrote in >news:3BB50884 DOT 347A4384 AT yahoo DOT com: > >> Thank you. I knew there was a reason I made my equivalent >> (revstring) a void function. I just didn't know what it was :-) > >The usefulness of a strrev function depends very much on what you intend to >use it for. For example, if your program is looking for palindromes, you >might want to use something like: > >strcmp(word, strrev(word)); > >i which case the in-place nature of the proposed function is really not >helpful. on the other hand, if one wants to use strrev this way, there are >other issues such as: where did the string returned by strrev come from >(similar to strdup). if the memory was allocated dynamically, the caller >needs to remember to free it. can strrev return NULL? if it is allocated >statically, the function is not thread-safe so on and so forth. > >the proposed in-place strrev would address a very narrow issue, and provide >a solution to only a very small number of problems. hence, my belief that >it is better for programmers to implement their specific solution. > >Of course, it is only my opinion. > >Sinan.