Code: Select all
Structure MyStruct
a.w
b.l
End Structure
*foo = @TheStruct.MyStruct
Debug *foo\a
The problem for me is that by attaching the 'pointed to' type to the pointer, it could appear as though it is actually that type, not a pointer. For example:
test.l = 9999999 ; This test is a long
*test.b = @source.b ; So is this one really, but it points to a byte.
test.b = 127 ; This one is a byte, but it sure looks like that other one!
Now, since the .b after *test is not necessary after it is initialized one could easily forget what type it points to. I'm sure PB sets the pointer type based on what it's pointing to, rather than what we tell it we're pointing to. That is, if I say:
test.b = 127
*newtest.w = @test
I would hope this would generate an error, although if the .w was optional PB could get the type by examining what we're actually assigning it from:
test.b = 127
*newtest = @test
Now PB looks at the @test part and determines that it is a byte. I can only think of one reason that the type suffix on the pointer would be necessary, and that is code clarity (programmer discipline - like forcing declares, etc). PB knows what it's pointing to, and we do too, because we assigned it!
Anyway, if I increment a word pointer by one, does it increment the actual address by two, since it is a word pointer? That would be handy, but potentially slow or dangerous if it's on an odd byte boundary to begin with.
Russell