Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Bug Reports
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Bug Reports Post about errors or bugs encountered.


Strange subroutine output


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-31-2008, 02:42 PM
Junior Member
 
Join Date: May 2007
Posts: 45
Default Strange subroutine output

Hi,
sometimes I need to fill in a string with a character to achieve a concrete length of this string. So I've written a simple subroutine, which is working for me for a quite long time. Now I found a problem when I use optimized compilation. You can see it on attached example.

Try to write for example number 1 to Input textbox and click on OK button. On the Result textbox should appear 00001 (subroutine fills it in 5 character length).
From IDE and from non optimized compilation it works. But if I use optimized compilation in the Result textbox is 001. Strange.

Has anybody some idea, please ?
Petr
Attached Files
File Type: sbp Tst.sbp (897 Bytes, 4 views)
Reply With Quote
  #2 (permalink)  
Old 01-31-2008, 03:00 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,488
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

It's because you have StrLength(inp) in your For condition. In the IDE it is calculated once at the start of the loop, in the compiler it is calculated each pass round the loop. This works

i = length - StrLength(inp)
For sdi = 1 To i
Reply With Quote
  #3 (permalink)  
Old 01-31-2008, 03:11 PM
Junior Member
 
Join Date: May 2007
Posts: 45
Default

You're very fast and you're right.
I didn't know about this. It means I must check all my old programs for it.
Thank you very much Agraham.
Petr
Reply With Quote
  #4 (permalink)  
Old 01-31-2008, 07:18 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 2,985
Default

This will be fixed in the next release.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Text output with scrollbar...? TWELVE Questions & Help Needed 2 04-28-2008 09:37 AM
CSV file generates strange start in file sunnyboyj Questions & Help Needed 9 12-21-2007 08:38 PM
Returning subroutine error - Input string was not in the correct format HarleyM Questions & Help Needed 4 10-20-2007 06:45 AM
Strange characters pmu5757 Questions & Help Needed 2 09-30-2007 08:56 AM


All times are GMT. The time now is 04:33 AM.


Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0