Byte Ptr Var

BlitzMax Forums/BlitzMax Programming/Byte Ptr Var

beanage(Posted 2009) [#1]
Hey,

I experienced this today and I'm a little dissatisfied with it.
The Problem is:

Function MyFunction( MyPtrVarPtr:Byte Ptr Var )
   'do stuff
End Function

Local MyPtrVar :Int Ptr
MyFunction MyPtrVar


This example does not compile. (mismatching types error)
But.. I mean.. don't all pointer types do kinda inherite from the Byte Ptr (Correct me!)? This should work imho. Give me a case where it would be impractical to have this working!

This propably counts as a "feature request xyz" but.. I just wanted to have this said ;)


GW(Posted 2009) [#2]
What are you trying to do? why do you need to pass the arg by reference?


beanage(Posted 2009) [#3]
The function actually takes more arguments, and the referenced byte pointer variable is adressed depending on the values of the arguments. Thats not much about "trying to do sthg", its something regular that just has to work, and writing five functions for all different types of value pointers (what I now did) is not effective.


N(Posted 2009) [#4]
But.. I mean.. don't all pointer types do kinda inherite from the Byte Ptr (Correct me!)?
No. There's your problem, solution's pretty obvious.


beanage(Posted 2009) [#5]
Of course I know the "solution" is to make my local being a Byte Ptr, or the Byte Ptr Var being a Int Ptr Var, I was just *hoping* for automatical conversion, which I thought would happen in such cases.

I wanted to express my dissatisfaction with that particular behaviour, and I wanted to know whether theres ANY logic reason WHY there is no auto-conversion between the F****** pointer types when used by ref..

[Edit:] Excuse my language


N(Posted 2009) [#6]
Or you could just change the Byte Ptr Var to a Byte Ptr Ptr and pass the argument with Varptr MyPtrVar or whatever. Whether or not that'll work, I don't know off the top of my head, but it's more flexible than a byref argument.