Article View: gnu.gcc.help
Article #46559Re: [Q:H3] Strange behavior of the NULL pointer
From: Michael Meissner
Date: Tue, 08 Nov 1994 14:47
Date: Tue, 08 Nov 1994 14:47
29 lines
1798 bytes
1798 bytes
| In article <ROOT.94Nov5194835@technik.3-s.de>,
| Michael_Huehne <svr4adm@Germany.EU.net> wrote:
| >Running the same program under Solaris 2.3 produces a segmentation
| >fault!
| [...]
| > int *i = (int *) NULL;
| >
| > printf("i == 0 Adr: %d Cont: '%s'\n",(int) i, (char *) i);
| > fflush(stdout);
| >
| > /* Output SCO: i == 0 Adr: 0 Cont: '(null)' */
| > /* Output Sinix: i == 0 Adr: 0 Cont: '' */
| > /* Output SOLARIS2.3: Segmentation fault (core dumped) */
|
| The behaviour under SCO, HP-UX etc. is not a feature of the NULL
| pointer itself, but a feature of printf() that I have been very
| fond of, and that for reasons unknown to me, Sun chose to drop in
| Solaris 2:
I dunno, I seem to recall the same behavior in SunOS 3.5 on a sun3, so
I don't think it is that Sun has suddenly dropped NULL pointer support
in printf, it never had it. By the way, the standard stays that such
behavior is undefined.
--
Michael Meissner email: meissner@osf.org phone: 617-621-8861
Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142
Old hackers never die, their bugs just increase.
Technical Details
Message-ID:
<9411081443.AA00845@pasta.osf.org>Path:
arc1-ca.pugleaf.net!nntp.gmd.de!Germany.EU.net!EU.net!howland.reston.ans.net!math.ohio-state.edu!cis.ohio-state.edu!osf.ORG!meissnerReferences:
meissner@osf.ORG (Michael Meissner)Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,2e07cdda975bac10 X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1994-11-08 06:47:17 PST Path: arc1-ca.pugleaf.net!nntp.gmd.de!Germany.EU.net!EU.net!howland.reston.ans.net!math.ohio-state.edu!cis.ohio-state.edu!osf.ORG!meissner From: meissner@osf.ORG (Michael Meissner) Newsgroups: gnu.gcc.help Subject: Re: [Q:H3] Strange behavior of the NULL pointer Date: 8 Nov 1994 09:47:17 -0500 Organization: GNUs Not Usenet Lines: 29 Sender: daemon@cis.ohio-state.edu Distribution: gnu Message-ID: <9411081443.AA00845@pasta.osf.org> References: meissner@osf.ORG (Michael Meissner)