🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #1198

Re: Pointers as 3-tuples (Re: JLG's flogging of horses (was Re: Relationship between C and C++))

#1198
From: Peter da Silva
Date: Wed, 11 Apr 1990 13:58
44 lines
1946 bytes
In article <14327@lambda.UUCP> jlg@lambda.UUCP (Jim Giles) writes:
> However, you have _NOT_ demonstrated that pointers which obey bounds are
> more general that arrays (they aren't).

Fine. How do you implement dynamic storage with arrays?

> In fact, what you are recommending is a constraint on pointers which
> removes one of the _only_ features that I thought pointers were useful
> for.

It would help if you would explain what this feature is, rather than
just telling me I've recommended a constraint on pointers (I've done
no such thing) that removes it (whatever it is).

> main(){
>        int A[10][20];
>        ...
>        sub1(A);
>        ...
> }
>        sub1(pa)
>        ...      /* somewhere here there should be a declaration
>                    which allows me to treat pa as a multiply dimensioned
>                    array.  I hope you can show it to me.  Everyone
>                    else claims that I have to declare a macro to do the
>                    subscript calculation (or, shudder, do the calculation
>                    by hand).  */

	int (*pa)[10][20];

		(*pa)[4][5];

> No, 'pa' is isomorphic to a one-dimensional array with bound 10*20==200.
> You can move 'pa' around linearly by adding and subtracting to it, but
> you can _never_ double subscript it.

		(*pa)[4][5];

Nope. Never.
-- 
 _--_|\  `-_-' Peter da Silva. +1 713 274 5180. <peter@ficc.uu.net>.
/      \  'U`
\_.--._/
      v
Technical Details
Message-ID: <7=U2P58xds13@ficc.uu.net>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!texbell!sugar!ficc!peter
References: <S4U2APBggpc2@ficc.uu.net> <14327@lambda.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!texbell!sugar!ficc!peter
From: peter@ficc.uu.net (Peter da Silva)
Newsgroups: comp.lang.misc
Subject: Re: Pointers as 3-tuples (Re: JLG's flogging of horses (was Re: Relationship between C and C++))
Message-ID: <7=U2P58xds13@ficc.uu.net>
Date: 11 Apr 90 13:58:45 GMT
References: <S4U2APBggpc2@ficc.uu.net> <14327@lambda.UUCP>
Reply-To: peter@ficc.uu.net (Peter da Silva)
Organization: Xenix Support, FICC
Lines: 39