It is currently Fri Oct 18, 2019 12:40 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: ReadStringFormat() - PB 4.4
PostPosted: Tue Oct 06, 2009 1:31 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10525
Location: Beyond the pale...
Hi,

just an observation really.

The values of #PB_Ascii and #PB_Unicode have changed since PB 4.31. This caused one of my programs to break which took a long time to figure out why? I always relied upon ReadStringFormat() returning a value in which #PB_Ascii was the highest value supported by PB's ReadString() command and it is this which caught me out!

Just posting as a warning to others and to ask why this was changed? Just out of curiosity you understand! :)

_________________
I may look like a mule, but I'm not a complete ass.


Top
 Profile  
Reply with quote  
 Post subject: Re: ReadStringFormat() - PB 4.4
PostPosted: Wed Oct 07, 2009 6:22 am 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 19, 2005 5:05 pm
Posts: 1769
Location: Norway
Well, what you did was bad programming practice, relying on a behaviour that didn't exist.
I really doubt that the values are enumerations, just plain constants? (looks at Fred)
Now that I think about it, I don't think any PB built in constants/flags are enumerated at all, maybe a note should be put in the manual about this?
Hmm, actually the OSVersion ones are the only ones I can think of that seem enumerated in some way.


Top
 Profile  
Reply with quote  
 Post subject: Re: ReadStringFormat() - PB 4.4
PostPosted: Wed Oct 07, 2009 10:05 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10525
Location: Beyond the pale...
Yes I agree; bad practice, though it made for more efficient code at the time. I did not hard code the values if that is what you are thinking; I just had a line similar to : If StringFormat <= #PB_Ascii... etc. It is because the ordering of the values in question changed which caught me out.

I just didn't expect these constant values to change - a foolish assumption I know, but, well, not an entirely unreasonable one I reckon. :)

All said and done, the problem is resolved; I was just left wondering why the values have changed - having a naturally inquisitive mind and all? :wink:

_________________
I may look like a mule, but I'm not a complete ass.


Top
 Profile  
Reply with quote  
 Post subject: Re: ReadStringFormat() - PB 4.4
PostPosted: Wed Oct 07, 2009 1:03 pm 
Offline
PureBasic Team
PureBasic Team
User avatar

Joined: Fri Apr 25, 2003 5:21 pm
Posts: 5781
Location: Germany
> I was just left wondering why the values have changed - having a naturally inquisitive mind and all? :wink:

#PB_Ascii and #PB_Unicode now also represent the .a and .u type for functions like Bin(), StrU() etc, and there was a colision with the constant for another type.

_________________
quidquid Latine dictum sit altum videtur


Top
 Profile  
Reply with quote  
 Post subject: Re: ReadStringFormat() - PB 4.4
PostPosted: Wed Oct 07, 2009 1:17 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10525
Location: Beyond the pale...
Ah, yes that makes sense.

Thanks; curiosity satisfied! :)

_________________
I may look like a mule, but I'm not a complete ass.


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 7 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