Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
concatenation of a str and a str function result (*solved*)
#7
boriel Wrote:Ok, you seems to have a bug in your code. ZX BASIC compiler is *case sensitive* by default. You have declared a function named stringIF (notice the uppercase F), but calls a different function named stringIf.

Thanks, I realized that while debugging. I mistyped the actual name (stringIf) in one or two calls, but that is not the cause of the problem because there are more calls with proper spelling.

boriel Wrote:Also calling a function before it's declared automatically declares it as Float, so you're effectively, concatenating a float function with a string (The compiler should do a better work, and has a bug, anyway). If you declare the function FIRST (at the top), your program will work:

You are right, it works. Thank you. I couldn't imagine the order has anything to do! Maybe it's in the docs, but I didn't see it. This feature forces me to rearrange the code quite a bit, because many secondary functions are declared at the end of the source...

boriel Wrote:Anyway: The compiler has a bug. It should not allow you to declare stringIF as String if you have already called it in your program-

What about a warning? There are warnings when a number is not declared, and the compiler declares them as float by default. If there were a similar warning when calling an undefined function, it would be easy to trace the problem.

Anyhow, is the default float issue to be changed in the future? It would be nice not to depend on the order the functions are defined.

By the way, I remember FreeBASIC needs the function headers to be declared at the start, what it quite annoying: you have to write them twice: at the function itself and at the top of the program. But I guess it has something to do with all this. That could be an alternative for ZX Basic too, to make sure all functions are declared at the start. Then their position in the source would'nt matter.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)