Closed GWRon closed 2 years ago
Is there a way for BCC detect this "wrong usage" and throw an informative error?
Yes, Local dogPtr:Animal = Varptr dog
should definitely a type error. Casting a pointer to a user-defined struct doesn't really make sense.
As discussed in the #code channel of the discord server I made this example here to "reference" a struct:
if you replaced the line:
with
it does not throw an error by bcc.
yet it generates some C code which does not compile:
The C code:
Is there a way for BCC detect this "wrong usage" and throw an informative error? Or is there a way to make this line "work" (so having two
animal
structs pointing to the same memory) -- something likeLocal spider:Animal = UnknownCommand(varptr dog)