Page 2 of 2

Re: Native types can't be used with pointers.

Posted: Tue May 13, 2014 11:21 am
by luis
User_Russian wrote:
luis wrote:One of the many threads about it, here you can read different opinions on the subject and the reasons behind the change
In the second post of topic, Fred did not answer. :?
I didn't say the explanations were coming from Fred in that thread, but the reasons behind are explained nevertheless, isn't that enough for you ?
http://www.purebasic.fr/english/viewtop ... 47#p400747

About converting it automatically:
The point is the compiler should never had allowed that in the first place. Doing some kind of automatic correction would permit people to still use that wrong syntax, maybe posting it in the forum because it's still working anyway etc. Better cut it off.

About using a warning:
PB uses warning to warn you to replace deprecated commands, commands that were legitimate but were replaced/changed in some way.
They are in fact still supported but that can change, so the warning.
Permitting the use of native types in pointer was just an oversight, it was never intended to be used, it was never legitimate. It was an error and it needed to be corrected because some people used that syntax, without a meaning, just because it was possible. The only use was a kind of cosmetic remark with no effect at all on the generated ASM code. *p.b, *p.l, *p.w, etc are all the same thing as *p because the type has no effect.
Specifying the type of a pointer (not a structured pointer) was and it's meaningless. You can't have a pointer of type byte.
And that code floating around was giving the wrong message to new users approaching the PB pointer's syntax. It had to be eradicated.

It's not the first time PB changes in some way and you have to update your sources, so do as usual.
Update your code and move on, it's just a search and replace.
I never used the meaningless syntax for the reasons explained before so for me the change was totally painless :)

Re: Native types can't be used with pointers.

Posted: Tue May 13, 2014 11:27 am
by Crusiatus Black
luis wrote:The only use was a kind of cosmetic remark with no effect at all on the generated ASM code. *p.b, *p.l, *p.w, etc are all the same thing as *p because the type has no effect.
Therefore accidental syntactic sugar, which one should not rely on. Good explanation