Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!srhqla!demott!kdq From: kdq@demott.com (Kevin D. Quitt) Newsgroups: comp.lang.c Subject: Re: Pointer arithmetic Message-ID: <1991Jan9.185424.20740@demott.com> Date: 9 Jan 91 18:54:24 GMT References: <1991Jan5.001607.5915@demott.com> <2788A63D.A86@tct.uucp> Organization: DeMott Electronics Co., Van Nuys CA Lines: 22 In article <2788A63D.A86@tct.uucp> chip@tct.uucp (Chip Salzenberg) writes: >If strchr() wasn't declared properly, gcc would complain. > >But a more serious complaint is the lack of a check on the return >value of strchr(). It might be NULL, after all, in which case the >subtraction will send the resulting value into deep space. As I indicated, strchr was not being declared; it's not declared in the same include file as with Microsoft C. I'm used to compilers that complain when things are declared, so I'm used to silence as being a sign that everything's OK. And you're right about checking the return value. This code is a fragment from an encryption package, which is why I had to change it to ask my question. When I get to the line with strchr, I have already guaranteed that the search will not fail. -- _ Kevin D. Quitt demott!kdq kdq@demott.com DeMott Electronics Co. 14707 Keswick St. Van Nuys, CA 91405-1266 VOICE (818) 988-4975 FAX (818) 997-1190 MODEM (818) 997-4496 PEP last