[Implemented] Suggestion to avoid a PB incoherence

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

GedB wrote:

Code: Select all

len(*var3)
you can not apply Len() to a 32bit integer, but to a PB string.
So then it should and would return an error:

Code: Select all

Debug Len(34)
See yourself :wink:

And by the way, is it so difficult to see? :o
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

Psychophanta,

The whole idea of a pointer is that you can treat it as the variable type it is pointing to.

If you want a 32bit integer, then use a long.

What, exactly, are you trying to achieve?
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

Post by Xombie »

Psychophanta,

A mose is a mose, a rose is a rose and a nose is a nose as a fairly famous song went. A pointer simply points to a 32 bit address in memory. The variable in that 32 bit address can be whatever it needs to be. So while for readability it might be nice to say *HoldPoint.s = @"Test", you're trying to assign a 32 bit address (long) variable to a string which breaks some rules. What if you need to point to *HoldPoint ? Do you use *MorePoint.l = @*HoldPoint ? Or is it again *MorePoint.s = @*HoldPoint?

Rather, wouldn't it be easier to name your variable something to let you know what's being pointed to? *HoldString.l = @"Test" is much more readable to me and I don't have to worry about the ".s"

Which brings me to another point (ha ha). Do you always type the ".s" when using that variable in your code? If not, don't you lose the readability? And if you do, doesn't it become too troublesome after a while? Whereas if you always use something like *HoldString you know it's a pointer by the "*" and you know it's a string by the variable name. Or simply comment your code more so you never forget.

It doesn't seem to do very well to confuse the issue by saying a ".b" is a byte variable declaraction but could also be used in declaring a 32 bit address pointer to a byte variable.

That's just my thinking and it's quite possible that I'm missing the point.
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Re: [Implemented] Suggestion to avoid a PB incoherence

Post by Psychophanta »

Fixed! Xombie,
The rose (pointer variables) and the mose (no pointer variables) are all the samething: VARIABLES :!:
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Post Reply