Use Flags for Variable Results

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1287
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Use Flags for Variable Results

Post by Paul »

How about flags for Val, Str, Peek, Poke, GetDatabase, Read, Write, ReadPreferences, WritePreferences...

example:
Result=Val(String$,#PB_Long)
Result=Peek(*Memory,#PB_Double)

This way you could also change the results through code by simply changing the flag value. Very flexable :)

Other commands use flags to specify various results so why not be consistant?

Makes more sense than PeekB, PeekC, PeekD, PeekF, PeekL, PeekQ, PeekS, PeekW, etc...
Image Image
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Post by Rescator »

I agree, it's getting kinda messy with all these variants!
And Fred could even use his own Macro system to change

PeekQ() to Peek(x,#PB_Quad) at compile time, thus avoiding source compatibility issues.

EDIT: Or even the other way around, whatever is most efficient code/speedwise!
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

Rescator wrote:I agree, it's getting kinda messy with all these variants!
And Fred could even use his own Macro system to change
This is a good idea, but don't use PB's macro system, it's buggy when used heavely :shock:
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

This willl make the functions slower, so I doubt this will be implemented.
Post Reply