LB Booster
« Wut da heck? :-/ »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 05:06am



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 2  Notify Send Topic Print
 hotthread  Author  Topic: Wut da heck? :-/  (Read 1503 times)
datwill
Guest
question Re: Wut da heck? :-/
« Reply #9 on: May 2nd, 2015, 8:18pm »

Well, I called and defined the function correctly as far as I was aware. Is it true that you cannot call a function by simply typing:
functionName()
assuming that this function was already defined? I tried to (the one I was using required an argument), but it didn't work, and when I *nearly wink* switched to subs it worked. Idk whether I did something wrong or you can't call a function by itself huh...
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
question Re: Wut da heck? :-/
« Reply #10 on: May 2nd, 2015, 8:43pm »

on May 2nd, 2015, 6:56pm, tsh73 wrote:
somehow code from reply #5 crashes LBB with Internal error 26

That's what Daniel was asking about (Error 26 = 'No such variable'). I explained the cause in my reply to him: trying to end a SUB with END FUNCTION, which confuses LBB:

Code:
sub applyIcon windowHandle
.........
end function 

Or have I misunderstood your question?

Richard.
User IP Logged

tsh73
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 210
question Re: Wut da heck? :-/
« Reply #11 on: May 2nd, 2015, 8:49pm »

Richard, it never said to me "No such variable"
It just shows messagebox with title "Error" and text "Internal error 26" and quits.
I just don't like then program quits - how I'll debug it?

Yes I understand sub/function issue. Question is, does LBB supposed to quit in this case?
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
question Re: Wut da heck? :-/
« Reply #12 on: May 2nd, 2015, 8:50pm »

on May 2nd, 2015, 8:18pm, Daniel Atwill wrote:
Is it true that you cannot call a function by simply typing: functionName()

A function returns a value. If you don't want the returned value, then (for example) assign it to a dummy variable:

Code:
    dummy = functionName() 

But if you are throwing away the returned value, why are you using a function?

Richard.
User IP Logged

tsh73
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 210
question Re: Wut da heck? :-/
« Reply #13 on: May 2nd, 2015, 8:52pm »

Daniel,
Quote:
Well, I called and defined the function correctly as far as I was aware. Is it true that you cannot call a function by simply typing:
functionName()
assuming that this function was already defined? I tried to (the one I was using required an argument), but it didn't work, and when I *nearly * switched to subs it worked. Idk whether I did something wrong or you can't call a function by itself

Yes you can't call function by itself.
But again, "function" supposed to return a value. If you need a value, you will never call it by itself - you either store return value or use it (in expression etc)
If you need piece of code that *doesn't* have return value, then you naturally use sub.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
question Re: Wut da heck? :-/
« Reply #14 on: May 2nd, 2015, 9:22pm »

on May 2nd, 2015, 8:49pm, tsh73 wrote:
Question is, does LBB supposed to quit in this case?

What do you mean by "supposed to"?

If you mean "was it a deliberate design decision to quit?" then obviously not. LBB should never report an 'Internal error'; it means something has gone wrong internally and, if it quits unexpectedly, unsaved changes to the program may be lost.

But if you mean "is that what you would expect to happen?" then yes it is. The code of LBB is written in such a way that an END FUNCTION without a FUNCTION will fail with an 'Internal error 26'. There is nothing mysterious about it.

When writing LBB I concentrated on making an error-free BASIC program compile to an error-free executable, as I hope you would expect. Checking that the compiler behaves in a 'helpful' way when there is an error in the BASIC program is much more difficult!

A valid BASIC program is defined by the Syntax and Semantics of the language, and therefore in principle it is possible to test that every aspect of the compiler works correctly (not that I am claiming LBB does). However there is no 'specification' of an invalid BASIC program: the number of possible errors is close to infinite so it is not practical to test what happens in every case.

I have a large suite of test programs which I use to validate each release of LBB. But I don't have a suite of broken programs to test how LBB behaves with them!

Richard.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
question Re: Wut da heck? :-/
« Reply #15 on: May 3rd, 2015, 09:54am »

on May 2nd, 2015, 8:49pm, tsh73 wrote:
Richard, it never said to me "No such variable"

Although knowing what the 'Internal error' codes mean is helpful to me, in general it won't be useful to the LBB user (knowing that the error was 'No such variable' didn't help Daniel locate the bug in his program, in fact it led him astray). It's a bit like LB's error log, which is helpful to Carl but incomprehensible to most users!

However, for those who like to be inquisitive, the LBB error codes are documented and that's presumably how Daniel knew what 'Internal error 26' actually means:

http://www.bbcbasic.co.uk/bbcwin/manual/bbcwinc.html#trapprog

Richard.
User IP Logged

datwill
Guest
question Re: Wut da heck? :-/
« Reply #16 on: May 3rd, 2015, 3:29pm »

Thank you about the function thing (of course it's meant to return a value - silly me), and yes I should've used a sub and I have.

Oh yeah, you know about the public offer of anyone willing to become an administrator (I can' remember where I've read that - i think it was in the thread on being banned from the LBCF)? Am I aloud to be one cool? If I can, thanks a lot!
« Last Edit: May 3rd, 2015, 3:37pm by datwill » User IP Logged

tsh73
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 210
question Re: Wut da heck? :-/
« Reply #17 on: May 5th, 2015, 07:13am »

Quote:
However, for those who like to be inquisitive, the LBB error codes are documented and that's presumably how Daniel knew what 'Internal error 26' actually means:

Thank you, Richard.
User IP Logged

datwill
Guest
question Re: Wut da heck? :-/
« Reply #18 on: May 5th, 2015, 10:47am »

I didn't it literally told me "no such variable"
User IP Logged

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


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