TH> "SUB pout (x%, x$, t as string * 15)"
TH> Did work this time. I note that the '15' *must* be the
TH> same value used in the TYPE declaration. Perhaps that is
TH> why it didn't work last time. I'm not sure anymore.
th>.......................................................
The major reason why passing a TYPE works immediately in
Quick Basic and not in Power Basic is that QB will automatically
create your DECLARE for you if the SUB or FUNCTION is in the
same module as the code calling it. Try this example.
The beauty of this in Power Basic is that passing a structure of
this type only uses a single pointer on the stack, whereas, in
Quick Basic, it uses a good chunk of the stack and you DO NOT
get it back when you return from the SUB or FUNCTION.
This type of programming technique can badly cripple a QB45
program, in which you are much better off to declare your
structure variables as SHARED instead.
type txtstruct
length as integer
t as string * 40
end type
declare sub txtprint(t as txtstruct) 'THIS is required here
dim text as txtstruct
text.t = "hello": text.length = len(rtrim$(text.t))
txtprint text
print text.length; text.t
end
sub txtprint(t as txtstruct)
print t.length; t.t
t.t = "goodbye": t.length = len(rtrim$(t.t))
end sub
___
> ] Well, I wasn't expecting the Spanish Inquisition!...........
--- Maximus/2 3.01
1:278/216)
---------------
* Origin: The Programmer's Mark * Brooklyn, NY, USA: 718-921-9267
|