CompuServe Messages

Benchmark Modula-2

    25-Apr-93 12:13:25
Fm: Thomas M. Breeden 75210,2424
To: Art Steinmetz 76044,3204
Art, Harry is right. For the Benchmark, and probably just about any M2 compiler, a VAR parameter will simply result in the passing of the address of the parameter. So either way could be used. using "VAR param:record" can result in fewer "ADR(param)" constructs in your M2 program. OTOH, it's a little dicey in the case that a C NULL address is meaningful for the parameter. For Benchmark, and probably other compilers, you can get away with "paramptr := NIL" and then passing "paramptr^". It's never dereferenced, and so gets to the Library routine as 0. In the Benchmark v2.04 interface, I generally used the VAR param:record approach, since that is the one generally used in the earlier interface. In cases where I knew that NIL would be often used, however, I declared it the other way, "paramptr:recordptr". Tags are really the same thing. C's variable number of parameters is not an issue, since every tag based routine has a "A", array of tags, version. Using M2's open arrays might be reasonable, but for efficiency I just declared the tag array as "VAR t:TagItem", with the expectation that "t[0]" would be sent. A "TagDone" tag will always end the tag array. I left the .tiData field of the TagItem as LONGCARD. A type transfer has to be used to assign a pointer into that field. Tom Breeden 75210,2424