Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!killer!ames!mailrus!uflorida!novavax!proxftl!bill From: bill@proxftl.UUCP (T. William Wells) Newsgroups: comp.lang.c Subject: Re: Structure pointer question Message-ID: <450@proxftl.UUCP> Date: 11 Jul 88 08:30:06 GMT References: <361@teletron.uucp> <8074@brl-smoke.arpa> <4524@haddock.isc.com> <399@teletron.UUCP> Organization: Proximity Technology, Ft. Lauderdale Lines: 34 In article <399@teletron.UUCP>, andrew@teletron.UUCP (Andrew Scott) writes: > In article <424@proxftl.UUCP>, bill@proxftl.UUCP (T. William Wells) writes: > > The correct solution is to have your library deal with void *. > > If a raw void * bothers you, use typedef void *MESSAGE; and then > > type everything as MESSAGE. > > Indeed, I have been informed that this is the only truly portable way of doing > things. HOWEVER, I do not have a compiler that supports "void *" at the > moment, and I cannot stand seeing lint all hot and bothered about casts to > and from "char *". :-) > > Terrible reasons, I know, but it does look "cleaner" than using void * (to me, > at least) and I think it *would* be portable if all pointers to structures > had the same format. As I have come to see, while it is the case that structure pointers are somewhat equivalent, in the same way that constant zero and null pointers are somewhat equivalent, they do not have to have the same format. As I said, this is likely to work but not guaranteed, since while most implementations have all structure pointers with the same format, there is nothing that requires this. Were I you, I'd first try to get a new compiler, and failing that, I'd live with the messages from lint. If I really couldn't hack that, I'd create some programming to filter out the irrelevant complaints from lint. Also, to save yourself some grief, should you decide to go the char * route, write them as VOID * (or even void * if you are not afraid of getting a compiler that will barf on that) and use a typedef. This will save you headaches when you switch compilers. It might also make the programming mentioned in the previous paragraphs easier.