It is currently Wed Nov 20, 2019 8:35 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: [v5.1+] Define.i *Pointer allowed.
PostPosted: Sun Mar 31, 2013 12:39 am 
Offline
Addict
Addict
User avatar

Joined: Wed Dec 23, 2009 10:14 pm
Posts: 3121
Location: Boston, MA
Code:
Define.i *p1  ;<- No error if pointer Defined as .i?
Define *p2;.i ;<- Uncomment and Error: Native types can't be used with pointers.
Debug #PB_Integer
Debug TypeOf(*p1) ; Integer instead of Pointer?
Debug TypeOf(*p2) ; Integer instead of Pointer?
And, why does TypeOf(*somepointer) not return #PB_Pointer?
This is at least an error in Documentation?

_________________
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum


Top
 Profile  
Reply with quote  
 Post subject: Re: [v5.1+] Define.i *Pointer allowed.
PostPosted: Sun Mar 31, 2013 4:17 am 
Offline
Addict
Addict
User avatar

Joined: Sat Apr 26, 2003 8:26 am
Posts: 2936
Location: Planet Earth
skywalk wrote:
And, why does TypeOf(*somepointer) not return #PB_Pointer?
This is at least an error in Documentation?

There is no #PB_Pointer (yet).

For pointers, it returns the type the pointer points to.
Code:
Define.b *p0 ; wrong
Debug #PB_Byte
Debug TypeOf(*p0)

Define.i *p1 ; wrong
Debug #PB_Integer
Debug TypeOf(*p1)

Define *p2.Byte ; good
Debug #PB_Structure
Debug TypeOf(*p2)

Define *p3 ; anonymous pointer / pointer to void
Debug #PB_Integer
Debug TypeOf(*p3)

Adding a check for the Define.i and Define.b with pointers, pointers
can only be of type #PB_Structure or anonymous pointers (#PB_Integer).

Don't know, should it return #PB_Pointer or should it return the type that
the pointer points to (#PB_Structure)?
Maybe it should return something like #PB_PointerToStructure and #PB_AnonymousPointer,
as only this two are valid?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye