Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!tut.cis.ohio-state.edu!bloom-beacon!mit-eddie!bbn!rochester!pt.cs.cmu.edu!andrew.cmu.edu!postman+uid0 From: snl@cs.cmu.edu (Sean Levy) Newsgroups: comp.lang.c Subject: NULL etc. Message-ID:Date: 26 Jun 88 10:19:43 GMT Organization: Carnegie Mellon Lines: 33 Here's part of what I do: #define NIL(t) ((t *)0) /* might change to some strange */ /* number for the 48-bit datapath HP's :-) */ #define NULL NIL(char) /* for backwards compatibility */ Then, f'rinstance struct hostent *hp; hp = gethostbyname(argv[1]); if (hp == NIL(struct hostent)) /* call lost */ ... I find this much easier to read. I don't write NULL in code anymore, I use NIL(char). Being a combo Lisp/C programmer, NIL makes more sense to me as a name for the pointer that points at nothing than NULL does. I type fast enough that I don't really make an issue of having to type an extra 5 characters to get what everyone seems to call a "NULL pointer" on this list. I would add that distinctions between 0 and a pointer become VERY important at a place like CMU, where code may be compiled on RT's, Suns, uVaxen and god knows what else. The above #define's go in a header file called "basic.h" on my personal include path. I only include in modules that, well, do I/O. I'm also going to switch completely to C++ verrrry soon... Sean Levy Engineering Desingn Research Center (EDRC), CMU Internet: snl @ cs.cmu.edu BITNET: snl%cs.cmu.edu@cmccvma UUCP: beast me. here's a couple that seem to work west coast: ...!{ucsdhub|sdcsvax}!snl@cs.cmu.edu east cost: ...!harvard!snl@cs.cmu.edu