* Code generation for generic packages - Question
@ 1988-11-16 18:27 "Jonathan B. Owen"
0 siblings, 0 replies; only message in thread
From: "Jonathan B. Owen" @ 1988-11-16 18:27 UTC (permalink / raw)
I use generic packages quite extensivly. This does not mean I understand
what code is generated out of the sources I write. This can be a problem
when trying to consider code efficiency...
What is performed in run-time each time the following is invoked:
procedure GENERIC_QUESTION( name : string ) is
subtype this_string_type is String(name'RANGE);
package THIS_CRUNCH is new STRING_CRUNCH( this_string_type );
begin
THIS_CRUNCH.STEP_ON_STRING( name );
end GENERIC_QUESTION;
When is the code produced? My immediate guess, is that the package
THIS_CRUNCH is creates ONCE for type "string" and not each time the
procedure is invoked with a different string. Am I right?
I came up with the above code while writing it, so don't try to make
sense out of it. Also, I have not thought out if the above is
necessary for creating a generic package for each subtype of type
"string". What I do know, is that I have encountered the need to
declare a subtype as a function of an unconstrained formal parameter.
And then, with this subtype, declare an instantiation of a generic
package.
Thanks for any clarification,
JB
______________________________________________________________________________
(--) /--) /-(\ Email: gdau100@bguvm (bitnet)
\ / /--K | \|/\ /\/) /|-\ Snail: 55 Hovevei Zion
_/_/o /L__)_/o \/\__/ \X/ \_/ | |_/ Tel-Aviv, 63346 ISRAEL
(/ Jonathan B. Owen Voice: (03) 281-422
Point of view: A chicken is the means by which an egg reproduces an egg.
______________________________________________________________________________
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1988-11-16 18:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1988-11-16 18:27 Code generation for generic packages - Question "Jonathan B. Owen"
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox