LB Booster
« 'Line too long' error »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 04:27am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: 'Line too long' error  (Read 930 times)
tsh73
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: 'Line too long' error
« Reply #4 on: Jul 24th, 2016, 08:54am »

Code:
But I would be interested in other people's opinions. Do you write code with very long lines (including DATA statements), and if so why? 


Was it actually code written by a person?
I've seen program that puts other files into huge DATA lines.
And reasons for it to be huge is
1) nobody supposed to read that anyway
2) it works in JB/LB, so why bother splitting strings.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: 'Line too long' error
« Reply #5 on: Jul 24th, 2016, 09:35am »

on Jul 24th, 2016, 08:54am, tsh73 wrote:
Was it actually code written by a person?

Good question: I don't know.

Quote:
it works in JB/LB, so why bother splitting strings.

Why bother? Here are a few reasons:
  • Whether it appears to work is not the whole story, what matters is whether it's permitted by the LB docs. Do they state anywhere what the maximum length of a program line is?

  • A Liberty BASIC program is stored as a plain-text (.BAS) file, which you may want to manipulate - edit, print etc. - using other programs designed to work with plain text files. Many (for example Notepad) have a maximum line length.

  • Even if the DATA statements are not intended to be read by a human, the rest of the program presumably is. If you want a hardcopy version to browse, it's easier to print the entire program than just part of it.

  • Is there any guarantee that LB 5, in the unlikely event of it ever being released, will support very long lines?

  • The "precautionary principle": don't take unnecessary risks if they are easily avoidable.
If the DATA statements are generated automatically, it's probably just as easy to make them a sensible length than ridiculously long. So rather than ask "why bother?" I'd want to ask "why not?".

Richard.
User IP Logged

tsh73
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: 'Line too long' error
« Reply #6 on: Jul 24th, 2016, 12:06pm »

here's an example of program that churns out big data lines
Small scribble editor
It happened that splitting long lines was not so obvious as just start another DATA line. That's because then I started, problem of long lines never came to my mind.

It looks like it was last change in the program. So it was changed for purely cosmetic reasons.
User IP Logged

Jack Kelly
Full Member
ImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 106
xx Re: 'Line too long' error
« Reply #7 on: Jul 24th, 2016, 5:24pm »

I too try to avoid long code lines that require the horizontal scroll bar. No problem using the underscore continuation character when necessary. I sometimes overlook the problem if the line is just a few characters too long, although I never print out the code.

This brings to mind a similar question I had recently. Is there any limit to the length of a string?
« Last Edit: Jul 24th, 2016, 5:26pm by Jack Kelly » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: 'Line too long' error
« Reply #8 on: Jul 24th, 2016, 8:14pm »

on Jul 24th, 2016, 5:24pm, Jack Kelly wrote:
Is there any limit to the length of a string?

In LBB strings are limited in length only by the amount of available memory (heap). It's hard to predict what the limit will be in practice because it depends on how much memory is being used by other objects (e.g. arrays) and how much is unavailable (e.g. string garbage).

You can use the LBB debugger to find the current heap usage, so subtracting that from the initial allocation (usually 500 Mbytes, unless reduced by an INI file setting) will give you a rough idea of the available memory.

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls