From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 102b75,85404311f8041f7a X-Google-Attributes: gid102b75,public X-Google-Thread: 1164f8,5747331edea7cbab X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 2001-07-18 09:13:23 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!news2.euro.net!newspeer.clara.net!news.clara.net!server3.netnews.ja.net!news.ox.ac.uk!c98pa From: c98pa@comlab.ox.ac.uk (Philip Armstrong) Newsgroups: comp.sys.dec,comp.arch Subject: Re: using memory beyond the "top" of stack Date: Wed, 18 Jul 2001 16:13:21 +0000 (UTC) Organization: Oxford University Computing Laboratory, UK Message-ID: <9j4cj1$2cs$1@news.ox.ac.uk> References: <994616870.688233@haldjas.folklore.ee> <995458767.205555@haldjas.folklore.ee> <9j45pg$7qe$1@sunnews.cern.ch> <995470891.294985@haldjas.folklore.ee> NNTP-Posting-Host: xana.comlab.ox.ac.uk X-Trace: news.ox.ac.uk 995472801 2460 163.1.125.57 (18 Jul 2001 16:13:21 GMT) X-Complaints-To: newsmaster@ox.ac.uk NNTP-Posting-Date: Wed, 18 Jul 2001 16:13:21 +0000 (UTC) Xref: archiver1.google.com comp.sys.dec:5981 comp.arch:14257 In article <995470891.294985@haldjas.folklore.ee>, Sander Vesik wrote: >Take a look at what the following one gives you: > >#include > >main() >{ >printf(NULL); >printf("%s\n",NULL); >} phil@rocinante:~$ gcc -O -W -Wall testing.c -o testing testing.c:4: warning: return-type defaults to `int' testing.c: In function `main': testing.c:5: warning: null format string testing.c:6: warning: char format, void arg (arg 2) testing.c:7: warning: control reaches end of non-void function phil@rocinante:~$ ./testing (null) >But of course, you are welcome to continue assuming that linux always >does everything right and couldn't possibly be wrong in anything. As far as I'm aware the effects of invoking a null pointer are undefined as specified in the C standard. Failing to segfault on printf(NULL); and then printing (null) for the following line is therefore as standards compliant as segfaulting under this interpretation. I'm happy to be convinced otherwise however, though perhaps somewhere else ( comp.lang.c ? ) Phil -- nosig