Some useful macros ?

Share your advanced PureBasic knowledge/code with the community.
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Post by SFSxOI »

Very nice :)

How and when would you use the CHAR structure? I've seen the CHAR used in C++ code, is this the same thing?
User avatar
helpy
Enthusiast
Enthusiast
Posts: 552
Joined: Sat Jun 28, 2003 12:01 am

Post by helpy »

Hi technicorn,
technicorn wrote:

Code: Select all

Structure ADDRARRAY
  a.l[0]  ; We might get quad memory addresses with PB5 ?! ;)
EndStructure
If I change this code to:

Code: Select all

Structure ADDRARRAY
  *a[0]
EndStructure
... wouldn't a pointer be dependent on the compiler version? So if there will be a 64bit version of the compiler this would be "automatically" in the appropriate size.
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

Right after the Ubound macro was published I put it to good use into a RES file.

Last weekend I searched for a bug in LCP that only occured on translating a lot of class definitions in one project.
After changing the Ubound value with a fixed integer the bug disappeared.

Don't know if it's the macro itself or how the PureBasic compiler acts after the extensive use of a macro.

Is this the reason why there is no official UBound in the PureBasic language :?:

:evil:
Last edited by fsw on Mon Aug 21, 2006 3:56 pm, edited 1 time in total.
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Re: Some usefull? Macros

Post by fsw »

fsw wrote:
technicorn wrote:

Code: Select all

Macro Ubound(array)
  (PeekL(@array - 8) - 1)
EndMacro
Can somebody from the PB dev team tell me if this is the right approach and will it always work?
And if this command will be native in the future.
Never got a straight answer.
Now would be a good time.
Dr. Dri
Enthusiast
Enthusiast
Posts: 243
Joined: Sat Aug 23, 2003 6:45 pm

Post by Dr. Dri »

same kind of topic on the french forum
http://purebasic.hmt-forum.com/viewtopic.php?t=4667

Dri
Post Reply