Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!apple!agate!shelby!portia!dhinds From: dhinds@portia.Stanford.EDU (David Hinds) Newsgroups: comp.lang.pascal Subject: Re: Absolute troubles Message-ID: <8470@portia.Stanford.EDU> Date: 22 Jan 90 21:51:12 GMT References: <7559@chaph.usc.edu> Sender: David Hinds Organization: Stanford University Lines: 44 In article <7559@chaph.usc.edu>, ajayshah@aludra.usc.edu (Ajay Shah) writes: > type > VectorType = array[1..10] of real; > > procedure xxx(var theta:VectorType); > var > sigma : real absolute theta; > beta : VectorType absolute theta[2]; The 'sigma' declaration apparantly works, but the 'beta' declaration fails. Actually, I'm surprised either of them works. You are asking the compiler to give a variable the same address as a parameter passed by reference, which inherantly means that the address is not defined at compile time. The compiler might not catch it as an error, but if I were you I would try running some kind of test program with just a 'sigma'-like declaration, to see if it ACTUALLY works. You definitely can't get away with the theta[2] declaration. If a 'sigma'-like declaration really can be handled properly by the compiler, you could instead declare a record with two fields, called 'sigma' and 'beta', of the appropriate types, 'absolute theta'. The subfields of the record would then correctly refer to the parts of the passed vector. i.e., procedure xxx(var theta: VectorType); type thetatype = record sigma: real; beta: VectorType; end; var y: thetatype absolute theta; and use 'y.sigma' and 'y.beta' as the parts of 'theta'. I have a bad feeling about the use of 'absolute' with parameters, though. At worst, you could declare: y: ^thetatype; begin y := @theta; and refer to 'y^.sigma' and 'y^.beta' as your vector parts. - David Hinds dhinds@portia.stanford.edu