type circle_vars
as single x,y,rad
End Type
type FwdCS as circlestacker
type csbuf_vars
as FwdCS ptr cs
declare sub subtractive(byref p as circle_vars ptr)
end type
sub csbuf_vars.subtractive(byref p as circle_vars ptr)
with cs->best(0)
end with
end sub
type circlestacker
as long ub = -1
as circle_vars best(any)
end type
type circle_vars
as single x,y,rad
End Type
type circle_vars_t as circlestacker
type csbuf_vars
declare sub subtractive(byref p as circle_vars ptr)
as circle_vars_t ptr pcv
end type
sub csbuf_vars.subtractive(byref p as circle_vars ptr)
print p->x
print pcv->b.x
end sub
type circlestacker
as long ub
as circle_vars b
end type
No bug.
'circlestacker' and ('best()' or 'b') must be defined before using them.
The error message (error 70: Incomplete type) corresponds to 'circlestacker' not defined before use it through the forward declaration.
type circle_vars
as single x,y,rad
End Type
type FwdCS as circlestacker
type csbuf_vars
as FwdCS ptr cs
declare sub subtractive(byref p as circle_vars ptr)
end type
type circlestacker
as long ub = -1
as circle_vars best(any)
end type
sub csbuf_vars.subtractive(byref p as circle_vars ptr)
with cs->best(0)
end with
end sub
type circle_vars
as single x,y,rad
End Type
type circle_vars_t as circlestacker
type csbuf_vars
declare sub subtractive(byref p as circle_vars ptr)
as circle_vars_t ptr pcv
end type
type circlestacker
as long ub
as circle_vars b
end type
sub csbuf_vars.subtractive(byref p as circle_vars ptr)
print p->x
print pcv->b.x
end sub
Last edited by fxm on Aug 20, 2017 9:09, edited 1 time in total.
type circle_vars
as single x,y,rad
End Type
type circlestacker
as long ub = -1
as circle_vars best(any)
end type
type csbuf_vars
as circlestacker ptr cs
declare sub subtractive(byref p as circle_vars ptr)
end type
sub csbuf_vars.subtractive(byref p as circle_vars ptr)
with cs->best(0)
end with
end sub
type circle_vars
as single x,y,rad
End Type
type circlestacker
as long ub
as circle_vars b
end type
type csbuf_vars
declare sub subtractive(byref p as circle_vars ptr)
as circlestacker ptr pcv
end type
sub csbuf_vars.subtractive(byref p as circle_vars ptr)
print p->x
print pcv->b.x
end sub
@fxm If classes are defined in seperate include files a compiler knows or read the interfaces.
That means "from my point of view" or in a perfect world :-)
after a forward declare a compiler must/can collect the implemented "missing"code in a second pass.
The same way are how forward declared jump labels are solved by an compiler.
Of course we don't live in a perfect world and your posted code looks more as workaround.
@fxm - if I were to swap the udts (your 2nd post) i'd have to forward reference csbuf_vars and it'd end up being the same issue. I'm only showing a fraction of my project code.
your first post might do the trick although I've implemented my own solution - an additional type to hold the data I'm trying to access, defined before everything