🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.mod2
Article #346

Re: extensions, a modest question

#346
From: Rob Nagler
Date: Sat, 22 Mar 1986 01:25
15 lines
1291 bytes
I believe that dereferencing a type cast is a bad idea.  This is just
like case variant records, but messier.  You should only need to do
this type of stuff in a very few places and having to do something 
grungy (like untagged variant records) will flag the few places with
a blazing mark to all who read the code.  If you make it too easy to
type cast and do other illicit deeds, I think programmers will take
advantage far too often.  Here is a random example from C:

    in_lnaof(((struct sockaddr_in *)&ifinet->if_addr)->sin_addr)

Yes, this is actual code that took me about 3 minutes to find 
in the 4.2 UNIX kernel.  I happen to know where the real bad
parts are.....

Rob
Technical Details
Message-ID: <8603220125.AA24674@orb.sun.uucp>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!ucbvax!sun.arpa!nagler%orb

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site ucbvax.BERKELEY.EDU
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!ucbvax!sun.arpa!nagler%orb
From: nagler%orb@SUN.ARPA (Rob Nagler)
Newsgroups: net.lang.mod2
Subject: Re:  extensions, a modest question
Message-ID: <8603220125.AA24674@orb.sun.uucp>
Date: Fri, 21-Mar-86 20:25:56 EST
Article-I.D.: orb.8603220125.AA24674
Posted: Fri Mar 21 20:25:56 1986
Date-Received: Sat, 22-Mar-86 23:05:44 EST
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: The ARPA Internet
Lines: 15