It is currently Mon Aug 03, 2020 10:44 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: [Done]7.2lts B2 DataSection - Read steps 2
PostPosted: Thu Mar 19, 2020 3:38 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Feb 01, 2012 3:30 pm
Posts: 766
Location: Nottinghamshire UK
Could not find this bug as being reported!
The Read from the data section steps 2 places at each read

Code:
CallDebugger
Restore ThisData
Define SelectedItem.l
For iIndex = 1 To 10
   Read SelectedItem
   Debug SelectedItem
Next


DataSection:
   ThisData:
   Data.l 1010101,18888,166666,977777
   Data.l 29999,155555,103333,14222222
   Data.l 3,1,14,17
   Data.l 4,1,18,25
   Data.l 5,2,10,19
   Data.l 6,3,4,9
   Data.l 7,3,10,15
   Data.l 8,3,18,29
   Data.l 9,4,10,29
   Data.l 10,5,18,19
EndDataSection

Zebuddi. :)

_________________
malleo, caput, bang. Ego, comprehendunt in tempore


Top
 Profile  
Reply with quote  
 Post subject: Re: 7.2lts B2 DataSection - Read steps 2
PostPosted: Thu Mar 19, 2020 4:17 pm 
Offline
Addict
Addict

Joined: Sat Feb 08, 2014 3:26 pm
Posts: 919
Yes, bug or feature ?
Contrary to what is indicated in the help, the absence of type with the Read statement does not take the default type.
For your example to work, you must write
Code:
Read.l SelectedItem
(Tested 5.71 LTS and 5.72 B2)

_________________
(English is not my native language, I use an online translator.)


Top
 Profile  
Reply with quote  
 Post subject: Re: 7.2lts B2 DataSection - Read steps 2
PostPosted: Thu Mar 19, 2020 4:21 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 14065
Location: France
It uses the default type (.i), so quad if it's on x64


Top
 Profile  
Reply with quote  
 Post subject: Re: 7.2lts B2 DataSection - Read steps 2
PostPosted: Thu Mar 19, 2020 4:25 pm 
Offline
Addict
Addict

Joined: Sat Feb 08, 2014 3:26 pm
Posts: 919
But with strings
Code:
Restore ThisData
Define SelectedItem.s

For iIndex = 1 To 10
   Read SelectedItem
   Debug SelectedItem
Next

DataSection:
   ThisData:
   Data.s "A", "B", "C", "D"
   Data.s "E", "F", "G", "H"
   Data.s "I", "J", "K", "L"
EndDataSection

Code:
---------------------------
PureBasic
---------------------------
Line 5: 'Read' can't convert automatically a number into a string.
---------------------------
OK   
---------------------------

But
Code:
Read.s SelectedItem
Works

:idea: I think it would be a good idea to specify in the help that it is better to always use the type for Read to avoid possible errors when compiling 32 and 64 bits.
Especially since, as it is shown, there will be no error message in case of a numerical value, but use one value out of two.

(In any case, this is not a bug, so the topic can be moved elsewhere to avoid cluttering up the BugList. :wink:)

_________________
(English is not my native language, I use an online translator.)


Top
 Profile  
Reply with quote  
 Post subject: Re: 7.2lts B2 DataSection - Read steps 2
PostPosted: Fri Mar 20, 2020 1:52 am 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 6254
Location: Wales, UK
... It is effectively a documents bug because the usage (and the gotchas) are not clear.

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
Reply with quote  
 Post subject: Re: 7.2lts B2 DataSection - Read steps 2
PostPosted: Fri Mar 20, 2020 10:45 am 
Offline
Enthusiast
Enthusiast

Joined: Fri Feb 24, 2012 10:19 am
Posts: 176
Updated with an example.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Done]7.2lts B2 DataSection - Read steps 2
PostPosted: Fri Mar 20, 2020 11:10 am 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 14065
Location: France
I actually might force to use a type for Read, as it's kind of confusing. Without type, it would raise an error


Top
 Profile  
Reply with quote  
 Post subject: Re: [Done]7.2lts B2 DataSection - Read steps 2
PostPosted: Fri Mar 20, 2020 12:04 pm 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 6254
Location: Wales, UK
+1

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Done]7.2lts B2 DataSection - Read steps 2
PostPosted: Fri Mar 20, 2020 2:52 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Apr 25, 2003 9:27 pm
Posts: 204
Location: Kent, UK
+1

Regards

Andy

_________________
Regards

Andy

Image
Registered PB & PureVision User


Top
 Profile  
Reply with quote  
 Post subject: Re: [Done]7.2lts B2 DataSection - Read steps 2
PostPosted: Fri Mar 20, 2020 4:56 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Feb 01, 2012 3:30 pm
Posts: 766
Location: Nottinghamshire UK
+1 Thanks for the info guys :)

Ps Say safe everyone :)

Zebuddi.

_________________
malleo, caput, bang. Ego, comprehendunt in tempore


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


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