Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!rochester!kodak!gizzmo!lazlo!mobile!dave From: dave@mobile.UUCP (David C. Rein) Newsgroups: comp.unix.wizards Subject: Re: Referencing NULL pointers Summary: What about portability? Message-ID: <176@mobile.UUCP> Date: 12 Jul 89 17:38:37 GMT References: <19367@paris.ics.uci.edu> <1891@auspex.auspex.com> <32UP02Eg3d=801@amdahl.uts.amdahl.com> Lines: 34 In article <32UP02Eg3d=801@amdahl.uts.amdahl.com>, vohra@uts.amdahl.com (Pavan Vohra) writes: > In article <1891@auspex.auspex.com> guy@auspex.auspex.com (Guy Harris) writes: > >> Apparantly, on other machines this is perfectly valid, since I see > >> quite a lot of this in code created on certain non-sun machines. > > > >No, it's not valid, it just happens to work - and only on *some* other > > I would say that the code is valid. > [..stuff deleted..] > Anyway, it is the operating system that makes the action that the > process takes valid or invalid. > > KC borrowing vohra Well, since the operating system we are discussing here is *NIX, I don't understand your comment of 'the operating system that makes the action...valid or invalid', or are we just dropping the idea of portability? The fact that you might be able to access 0 is meaningless. In AIX PS/2, if you do a (i.e.) printf("%s", (char *)0); you'll get: L since this is the magic number for AIX executables. Basically, a program that makes the assumption that it can dereference possibly uninitialized pointers is not a well written program (in my opinion). And, most important of all, since not all *NIX systems allow for this (as they should not!), it hinders the portability of code, which is one of the foundations of *NIX! Dave Rein ----------------------------------\ /----------------------------------------- UUCP: ..!kodak!gizzmo!lazlo!\ \/ "It just goes to show what you can do mobile!dave /\ if you're a total psychotic" Domain: dcr0801@ritcv / \ -- Woody Allen ---------------------------------/ \----------------------------------------