Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!lavaca.uh.edu!uhnix1!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: <4_V2E0Cxds13@ficc.uu.net> Date: 12 Apr 90 15:48:58 GMT References: <7=U2P58xds13@ficc.uu.net> <14342@lambda.UUCP> Reply-To: peter@ficc.uu.net (Peter da Silva) Organization: Xenix Support, FICC Lines: 30 > Pointers which obey bounds are worthless as dynamic memory implementors. > The dynamic memory allocator is what _sets_ the bounds - be pretty silly > to force it to obey them. Since you can't implement a dynamic memory allocator portably (of course not: it has to know what pointers look like and how to request blocks from the O/S) who cares? But suppose you want to implement a pool of fixed-sized memory between malloc and the user program (say, you want to allocate 27-byte and 192-byte chunks all the time, and rarely other sizes)... with arrays? > Nope, Nope, Nope, .... how does the guy who wrote 'sub1' know that the > array that will be passed has bounds 10 and 20? Answer: he doesn't. But that's not what you asked. > In fact, the routine might be called many times - with a differently > bounded array each time. Keep looking! You may find the answer yet! Why? So this particular thing is easier in Fortran than in C (or, I might add, in a bunch of other languages)... so what? I'd rather put up with a minor inconvenience (and it is minor... the macro to do dynamic sizing is TRIVIAL) than have to put up with all the things you just *can't* do in Fortran. Then again, I could work in some less-common language and find it quite impossible to even *get* compilers for most of the machines I use, let alone *compatible* ones. Fortran and C are about the only widely available languages with reasonably complete portable subsets. -- _--_|\ `-_-' Peter da Silva. +1 713 274 5180. . / \ 'U` \_.--._/ v