Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

char buf[LINE_MAX]

Name: Anonymous 2008-08-26 6:39

Why do programmers still code in arbitrary limits like these?

It breaks when you do
#define LINE_MAX UINT_MAX

Why not redesign so that you use an O(1) space algorithm, or if it can't be avoided, dynamically allocate as much as needed?

Name: Anonymous 2008-08-26 14:56

>>16
As long as you aren't calling something like that recursively, or a large-ish sequence of functions that all use these buffers, or you're developing for a PDP-11 running Plan 9 on Mars or something, I don't think you'd run into stack size limit problems easily when using stack-dynamic buffers that are reasonably big enough to hold the amount of data you're buffering.

And if you are in such a situation, as mentioned, it's time to realize that and reevaluate what the hell you're doing.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List