Re: volatile vs aliased



Randy Brukardt wrote:

This seems like a good time to mention that I think the explicit use of
System.Address in Ada 95 and Ada 200Y code is usually a mistake. Since
pragma Convention can be used to ensure that general access types have the
appropriate representation, its rare that Address needs to be used for
interfacing. (There is only a handful of uses of Address in Claw, for
example.)

I'd go further. First, I see if I can use an out or in out parameter of a Convention-C non-access type, rather than use a Convention-C access type. Most pointer parameters in C exist to get the effect of out or in out parameters, and "pragma Import (C, ..." will do the right thing for you without messing with access types.


Of course, if the C function has both pointer parameters and returns a value, access parameters are the only thing available. Is ease of interfacing to other languages another pro for allowing out and in out parameters for functions, along with making side effects visible?

--
Jeff Carter
"I soiled my armor, I was so scared."
Monty Python & the Holy Grail
71
.