Xref: utzoo comp.bugs.4bsd:1671 comp.std.c:4188 comp.lang.c:35500 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!well!jef From: jef@well.sf.ca.us (Jef Poskanzer) Newsgroups: comp.bugs.4bsd,comp.std.c,comp.lang.c Subject: Re: Safe coding practices (was Re: Bug in users command) Message-ID: <22879@well.sf.ca.us> Date: 25 Jan 91 05:14:32 GMT References: <22311:Jan2502:34:1191@kramden.acf.nyu.edu> Reply-To: Jef Poskanzer Organization: Paratheo-Anametamystikhood Of Eris Esoteric, Ada Lovelace Cabal Lines: 39 In the referenced message, brnstnd@kramden.acf.nyu.edu (Dan Bernstein) wrote: }Ah, yes, Jef takes his place next to Chris on my list of gurus I've }caught in a mistake. You're right, I didn't notice the i < lines + 50 test. I grovel at your feet O Master. }Now you can talk all you want about reallocating memory (btw, there's no }safe way to use realloc(), but you knew that) Actually, I didn't. Say more. }I'll skip the comments about a quadratic time requirement, Please do. }and about people who simply *talk* about code instead of *writing* code, Please get stuffed. }You won't be able to identify a }single functional requirement that your reallocating version You must have mis-read my message. I don't have any version which uses realloc. }This explanation isn't particularly lucid, You're right, but I understood it anyway. As long as you've got that overflow check in there, fine, it works. But after correctness you have to consider simplicity, and the fixed-size (but large and checked) array wins there. I realize they tell you in Computer Science School that you're not supposed to do things like this. I'm telling you now that it can be appropriate. --- Jef Jef Poskanzer jef@well.sf.ca.us {apple, ucbvax, hplabs}!well!jef Published simultaneously in Canada.