Xref: utzoo comp.sources.wanted:15408 alt.sources.wanted:959 comp.lang.c:36422 Path: utzoo!utgpu!cs.utexas.edu!uunet!meaddata!rob From: rob@meaddata.com (Robert E. Lancia) Newsgroups: comp.sources.wanted,alt.sources.wanted,comp.lang.c Subject: Re: What is strdup() supposed to do? Does anyone have a copy? Message-ID: <2979@meaddata.meaddata.com> Date: 22 Feb 91 17:55:30 GMT References: <1991Feb18.154159.430@persoft.com> <1991Feb19.004526.16033@onion.rain.com> Sender: usenet@meaddata.com Reply-To: rob@pmserv.meaddata.com Followup-To: comp.sources.wanted Organization: Mead Data Central, Dayton OH Lines: 38 >>>>> dag@persoft.com (Daniel Glasser) writes: Daniel>Nit #2: You should simplify your expression in the "malloc()", that is, Daniel> sizeof(char) * strlen(foo) + sizeof(char) Daniel> could be written Daniel> sizeof(char) * (strlen(foo) + 1) >>>>> jeff@onion.rain.com (Jeff Beadles) then said: Jeff> Untrue. What if sizeof(char) != 1? Yours will break, and mine Jeff> will work. >>>>> fischer@iesd.auc.dk (Lars P. Fischer) then writes: Lars> Gimme a break. Are you going to tell us that Lars> A * (B + 1) != A * B + A Lars> for A != 1 ?? If you can't handle basic arithmetic, what makes you Lars> think you can write a C program? I think Lars might have jumped the gun a bit here. Maybe, just MAYBE, Jeff mis-read Daniel's rewrite as sizeof(char) * strlen(foo) + 1 instead of (the correct) sizeof(char) * (strlen(foo) + 1) If this were the case, his comment makes perfect sense. Regardless, I'm giving Jeff the benefit of the doubt and blaming his eye doctor! :^) -- |Robert Lancia | I have a split | Mead Data Central |(513) 297-2560 | personality, and | Data Services Division |rob@pmserv.meaddata.com | these are HIS | P.O. Box 308 |...!uunet!meaddata!pmserv!rob | comments. | Dayton, Ohio 45401