From: "A. Sinan Unur" Newsgroups: comp.os.msdos.djgpp Subject: Re: Please add strrev proposal Date: 29 Sep 2001 01:00:32 GMT Organization: Cornell University Lines: 30 Sender: asu1 AT cornell DOT invalid (on slip-32-102-40-41.ny.us.prserv.net) Message-ID: References: <3BB50884 DOT 347A4384 AT yahoo DOT com> NNTP-Posting-Host: slip-32-102-40-41.ny.us.prserv.net X-Trace: news01.cit.cornell.edu 1001725232 26473 32.102.40.41 (29 Sep 2001 01:00:32 GMT) X-Complaints-To: usenet AT news01 DOT cit DOT cornell DOT edu NNTP-Posting-Date: 29 Sep 2001 01:00:32 GMT User-Agent: Xnews/4.06.22 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com 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. -- -------------------------------- A. Sinan Unur http://www.unur.com/