BMax Still Implicitly casts TAnything to Byte Ptr

BlitzMax Forums/BlitzMax Programming/BMax Still Implicitly casts TAnything to Byte Ptr

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I complained about this a while ago, and I was sure I read somewhere where Mark or Skid said that it had been or would be changed. Not on my thread, I don't think, but somewhere.

But no, it's still possible :

SuperStrict

Function AFunc(B:Byte Ptr)
End Function

Type TAnything
	Field Something:Int
	Field SomethingElse:Float
	Field SomethingDifferent:String
End Type

Global AThing:TAnything=New TAnything

AFunc(AThing)


or even
Type TAnything
	Field Something:Int
	Field SomethingElse:Float
	Field SomethingDifferent:String
End Type

Global AThing:TAnything=New TAnything
Global B:Byte Ptr=AThing


This is a debugging nightmare. It's so easy to make a mistake because the compiler won't alert you to it.

Now I don't mind if it happens in non-strict, I don't mind if it happens in Strict. I don't even mind if it's possible in SuperStrict as long as it's done with an explicit type cast. But to have TAnything cast to a Byte Ptr automatically is just asking for problems.

I fully accept that this problem only arises if you're a bit stupid ( I am! ) and you're prone to making a lot of stupid mistakes ( That's me! ) but that's what Strict and SuperStrict are for, isn't it? To stop stupid people making stupid mistakes?