Path: utzoo!attcan!uunet!husc6!bloom-beacon!gatech!ncar!tank!uxc!uxc.cso.uiuc.edu!uxg.cso.uiuc.edu!uxe.cso.uiuc.edu!mcdonald From: mcdonald@uxe.cso.uiuc.edu Newsgroups: comp.lang.c Subject: Re: retiring gets(3) Message-ID: <225800090@uxe.cso.uiuc.edu> Date: 11 Nov 88 20:34:00 GMT References: <54845@<1988Nov8> Lines: 19 Nf-ID: #R:<1988Nov8:54845:uxe.cso.uiuc.edu:225800090:000:875 Nf-From: uxe.cso.uiuc.edu!mcdonald Nov 11 14:34:00 1988 >gets() is deliberately required for ANSI C standard conformance because >a LOT of existing code relies on it. Any vendor who omits this function >will not be standard conforming and will not sell its compiler to those >(expected to be MANY customers) who specify standard conformance. How about fixing this, and the scanf and strcpy problems as well, by a little outside-the-standard kludge? (Okay, I realize that every time I suggest something like this, somebody tries to roast me, but I am flameproof.) That is #pragma _MAX_STRING_LENGTH=256 /*or some other suitable number*/ and the compiler would call special versions of gets, strcpy, and cohorts, that stopped at such a maximum. Now I am not sure whether the result of overrun would have to be a fatal error or whether it could just stop copying, but that would at least prevent old bugs from biting too bad.