Syntax error message: *(p+1)\v

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
IceSoft
Addict
Addict
Posts: 1685
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Syntax error message: *(p+1)\v

Post by IceSoft »

Missing a solution to change 'temporary' the pointer value:

I get a syntax error message with this one:

Code: Select all

*(p+1)\v
@Fred,
Please let it working (it is very important for using pointers)
Or give me the correct syntax ;-)
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Ther are many solutions. This one could help, i hope:

Code: Select all

*p.struc

*temp.struc=*p+SizeOf(struc)*1
*temp\v
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
IceSoft
Addict
Addict
Posts: 1685
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Post by IceSoft »

Psychophanta wrote:Ther are many solutions. This one could help, i hope:

Code: Select all

*p.struc

*temp.struc=*p+SizeOf(struc)*1
*temp\v
Sorry, that is not a solution!
That's only a workaround.

A solution don't need a second variable!
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

PB is not C...
quidquid Latine dictum sit altum videtur
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

It's not a bug, please post in the appropriate section.
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

freak wrote:PB is not C...
Of course :wink:
PB is much more complex than C if the user wants, and much more easy than C if the user wants. That's the power. :D
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Fred wrote:It's not a bug, please post in the appropriate section.
Fred , are you awake??? did you drink yesterday?
This is in request section! :lol:
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Because i just moved it :P.
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Fred wrote:Because i just moved it :P.
:oops:
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
IceSoft
Addict
Addict
Posts: 1685
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Post by IceSoft »

But this is a bottleneck.

@Fred,
I hope you add this very early.
Maybe it works if you change the syntax check only?

Code: Select all

(*p+1)\v
or

Code: Select all

*(p+1)\v
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Code: Select all

PeekB(*p+1) ; Or use whatever type you have there
quidquid Latine dictum sit altum videtur
User avatar
IceSoft
Addict
Addict
Posts: 1685
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Post by IceSoft »

freak wrote:

Code: Select all

PeekB(*p+1) ; Or use whatever type you have there
Ok, one more workaround.
It is not so fast as a directly pointer access is.

I hope the PB-Team adds this feature on the first 'PB Servicepack 1'.
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

As fr34k says, it's not C, and we don't plan to introduce a weird syntax for this kind of stuff.
User avatar
IceSoft
Addict
Addict
Posts: 1685
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Post by IceSoft »

Fred wrote:As fr34k says, it's not C, and we don't plan to introduce a weird syntax for this kind of stuff.
Come one @fred,
It is not weird. It is fast ;-)

Look this is not weird:

Code: Select all

*p+1
But you say this is weird (I using another sytax here)

Code: Select all

*p+1\v
Why?
Last edited by IceSoft on Fri May 05, 2006 10:18 am, edited 1 time in total.
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Because '1' isn't a variable so you can't acces its field ;). If it's only a speed matter, we can still put PeekX() in the compiler it self to avoid an extra call..
Post Reply