CompuServe Messages

#Baffled by Benchmark

    04-Dec-87 09:48:33
Fm: Steve Faiwiszewski 74106,425
To: Thomas Holaday 70407,534
Come on Tom! I'm surprised by you! The requirements to pass some parameters as addresses has nothing to do with Modula-2 or any high level language (HLL for short), but it has to do with what the ROM Kernel routines want to see. In numerous instances these routines want to get a pointer (same as address) to a string or some other data structure. In Modula-2 you can find the address of any variable using the ADR function. So ADR(foo) gives you the address of 'foo'. According to the strict M2 language definition, if you want to pass a string to a RK routine by address you would have to do the following: foo := 'Hello There'; SomeRKroutine(ADR(foo)); But Benchmark relaxes that a bit and lets you do SomeRKroutine(ADR('Hello There')) (which is really kind of weird, but save you the trouble of creating another variable). One thing to watch out for is because of this relaxation of the language definition, you can pass the address of a constant to some routine which might think that this is a string that it can change, and you end up changing a constant(!!!!!). Watch out for this!! Anyway, Wirth did NOT blow it, and string handling is not so bad in Modula-2 (although it could have been better). One last thing: The manuals for TDI and Benchmark are mostly there to document the interface to the RK routines, and nothing else. They are certainly no substitute for the RKM and Intuition manuals or some good M2 books. Hope this helped – Steve – (Wheww)