Hi
In a structure the "*" is used to defined a pointer in a structure but it is not used to reference the structure field later. I discovered this by accident when I tried something like myStruct\*myPointer\myValue and the compiler complained. I just assumed from the documentation that since the "*" was part of the variable name it would also be part of the structure field name.
Thanks,
Simon
Document "*" use in Structure Pointers
Document "*" use in Structure Pointers
Simon White
dCipher Computing
dCipher Computing
Re: Document "*" use in Structure Pointers
You might get used to it but it's still one of the most irritating things when dealing with structures, so: +1
Why wasn't this changed long time ago anyway? Fear of breaking backward compatibility? Well, with each release of PB there is always something improving on the syntax side and a couple of simple search'n'replaces should do it, right?!
Why wasn't this changed long time ago anyway? Fear of breaking backward compatibility? Well, with each release of PB there is always something improving on the syntax side and a couple of simple search'n'replaces should do it, right?!
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
Re: Document "*" use in Structure Pointers
Was requested to be documented and now is marked as [Done], so this should be marked the same way I suppose.
http://www.purebasic.fr/english/viewtop ... 37&t=52059
And this is the snippet that was added in the doc. This also answer your question.
http://www.purebasic.fr/english/viewtop ... 37&t=52059
And this is the snippet that was added in the doc. This also answer your question.
Even with this "hint" I still don't understand why it was so in the first place, but that's another story.When using pointers in structures, the '*' has to be omitted when using the field, once more to ease API code porting. It can be seen as an oddity (and to be honest, it is) but it's like that since the very start of PureBasic and many, many sources rely on that so it won't be changed.
"Have you tried turning it off and on again ?"
A little PureBasic review
A little PureBasic review
Re: Document "*" use in Structure Pointers
Oh sorry, I overread the "document" in the thread title. I +1'ed to change the syntax accordingly...
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!