Safe coding practices (was Re: Bug in users command)
Jef Poskanzer
jef at well.sf.ca.us
Fri Jan 25 16:14:32 AEST 1991
In the referenced message, brnstnd at 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 at well.sf.ca.us {apple, ucbvax, hplabs}!well!jef
Published simultaneously in Canada.
More information about the Comp.std.c
mailing list