🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #910

Re: Relationship between C and C++

#910
From: Preston Briggs
Date: Tue, 20 Mar 1990 22:17
36 lines
1296 bytes
In article <5200048@m.cs.uiuc.edu> robison@m.cs.uiuc.edu writes:

>Can anyone clue me as to the basis for pointer paranoia?

Just because I'm paranoid doesn't mean I'm stoopid.

Let's do some pointer arithmetic.
First we need some declarations:

	typedef struct {
		int i;		/* say 4 bytes */
		char c;
	    } Node, *Nodes;


	Nodes x, y;
	int i, j;

And then some code (assume with me that things are initialized):

	x = y + i;

This means assign the sum of y and i*5.  Not too bad, 1 shift and 3 adds.
Let's do some more:

	j = x - y;

Hmmm.  A subtract and a DIVISION by 5!?

This stuff is great!  Plus costs 4 times what it should and minus
becomes worse than division.  *And* it makes my code obscure to
myself and others, not to mention hard to optimize.  Such a deal.

--
Preston Briggs				looking for the great leap forward
preston@titan.rice.edu
Technical Details
Message-ID: <5919@brazos.Rice.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rice!titan!preston
References: <8432@hubcap.clemson.edu> <5200048@m.cs.uiuc.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rice!titan!preston
From: preston@titan.rice.edu (Preston Briggs)
Newsgroups: comp.lang.misc
Subject: Re: Relationship between C and C++
Message-ID: <5919@brazos.Rice.edu>
Date: 20 Mar 90 22:17:31 GMT
References: <8432@hubcap.clemson.edu> <5200048@m.cs.uiuc.edu>
Sender: root@rice.edu
Organization: Rice University, Houston
Lines: 36