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

Defensive Programming Squad

Name: Anonymous 2008-10-22 5:59

In this thread we pick up innocent programs and tank the shit out of them.

#include <stdio.h>
int main () {
  int n1, n2;
  printf("First integer:");
  scanf("%d", &n1);
  printf("Second integer:");
  scanf("%d", &n2);
  printf("Sum = %d\n", n1+n2);
  return 0;
}

Name: Anonymous 2008-10-23 11:34

>>30
Anonix doesn't (yet) define LINE_MAX.

POSIX only specifies that LINE_MAX must be at least 2048:
http://www.opengroup.org/onlinepubs/000095399/basedefs/limits.h.html
{LINE_MAX}
    Unless otherwise noted, the maximum length, in bytes, of a utility's input line (either standard input or another file), when the utility is described as processing text files. The length includes room for the trailing <newline>.
    Minimum Acceptable Value: {_POSIX2_LINE_MAX}

{_POSIX2_LINE_MAX}
    Unless otherwise noted, the maximum length, in bytes, of a utility's input line (either standard input or another file), when the utility is described as processing text files. The length includes room for the trailing <newline>.
    Value: 2 048


defining LINE_MAX equal to INT_MAX is stupid and would break a lot of existing code:
http://www.google.com/codesearch?as_q=char\s%2B\w%2B[LINE_MAX\]%3B&btnG=Search+Code&as_lang=c&as_case=y
Results 1 - 10 of about 2,000. (0.05 seconds)

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