String output routines

Coding and general discussion relating to user created compiler modules

Moderators: David Barker, Jerry Messina

Jerry Messina
Swordfish Developer
Posts: 1469
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: String output routines

Post by Jerry Messina » Fri Apr 18, 2014 5:17 pm

I don't know if the update has fixed the original issue, but when I use it on some existing projects I'm now getting messages like

Code: Select all

Warning[] E:rfsw.bas 1405 : Return string of function 'format_val' might not have been dimensioned
which is true... the function return value is just declared "as string".

I only get this for a few functions. I assume that the message will go away if I change the return declaration to something like "as string(10)"?

Is the compiler trying to tell me something that I should pay attention to?

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Re: String output routines

Post by David Barker » Fri Apr 18, 2014 5:30 pm

Yes, it's something you should look at. By default, function string returns are only two bytes. It has to be like that else the stack inflates with expressions such as funcstra() + funcstrb() and so on. A function return should expand if you make a direct string assignment. For example,

Code: Select all

function myFunc(str as string) as string
   result = str
end function
but dimensioning function return strings is easier to understand. This whole string problem is actually the result of me trying to optimise some compile times for large programs - ring any bells Jerry ;-) If the problem persists, I'll probably have to re-link the old code to fix and take another look at the compilation time problem...

Jerry Messina
Swordfish Developer
Posts: 1469
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: String output routines

Post by Jerry Messina » Fri Apr 18, 2014 6:36 pm

Well, I hope you don't have to go backwards.

V2220 also seems to have changed a few misc places where a larger type that req'd was being used (32bit vs 16bit, word vs byte, etc),
including clearing up the "movlw <int16>" asm instructions I've seen.

It was a little alarming at first, but then I realized it was actually saving me a few instructions here and there that weren't required (cross my fingers).

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Re: String output routines

Post by David Barker » Tue Apr 22, 2014 11:45 am

There was still a problem with 2.2.2.0. Could you please install the latest update (2.2.2.1) and let me know if it works correctly.

SHughes_Fusion
Posts: 219
Joined: Wed Sep 11, 2013 1:27 pm
Location: Chesterfield

Re: String output routines

Post by SHughes_Fusion » Wed Apr 23, 2014 9:27 am

I've not had the chance to test the update to see if it fixes the original problem, but it does appear to have broken some of the display routines I'd written. Whether the older version was masking a problem or whether the update has introduced a problem I don't know until I've had the chance to look further in to my code.

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Re: String output routines

Post by David Barker » Wed Apr 23, 2014 9:38 am

OK, when you have chance break it down to the smallest possible bit of code that shows the error and I will take a look.

SHughes_Fusion
Posts: 219
Joined: Wed Sep 11, 2013 1:27 pm
Location: Chesterfield

Re: String output routines

Post by SHughes_Fusion » Wed Apr 23, 2014 9:51 am

Don't worry, David, it appears there was an issue with my library that only showed up now.

I've also had the chance to restore the code that wasn't working before and the new update seems to have fixed the problem.

Thanks!

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Re: String output routines

Post by David Barker » Wed Apr 23, 2014 9:53 am

That's great news! I appreciate you letting me know...

Post Reply