Author Topic: Lacking QB4.5 error catch  (Read 4512 times)

0 Members and 1 Guest are viewing this topic.

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Lacking QB4.5 error catch
« on: December 16, 2021, 04:48:27 pm »
so in QB4.5 if you type the following line you will get an error at run time

Code: QB64: [Select]
  1. END of

However this is allowed in QB64(2.0.2); IDE does not flag, even the compilation does not fail.(just what happens to the 'of'?)

Found this when I accidentally hit the 'o' instead of 'i'. was supposed to be END IF not END OF but it wasn't flagged.
Granted after becoming radioactive I only have a half-life!

FellippeHeitor

  • Guest
Re: Lacking QB4.5 error catch
« Reply #1 on: December 16, 2021, 04:51:37 pm »
END takes a parameter, which is the return code your application will report to the calling operating system when it ends (same with SYSTEM). If your variable "of" contains the value of zero, that's what you're returning with that line.

FellippeHeitor

  • Guest
Re: Lacking QB4.5 error catch
« Reply #2 on: December 16, 2021, 04:52:21 pm »
BTW, Option _Explicit at the top would have told you that "variable 'of' is undeclared".

FellippeHeitor

  • Guest
Re: Lacking QB4.5 error catch
« Reply #3 on: December 16, 2021, 04:59:50 pm »
Back in QB4.5 these two commands wouldn't take parameters. Microsoft only fixed that with v7.1.

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: Lacking QB4.5 error catch
« Reply #4 on: December 16, 2021, 05:19:11 pm »
BTW, Option _Explicit at the top would have told you that "variable 'of' is undeclared".
it would also make me DIM nearly 500 descriptively named variables(not just a,b,c) of which roughly 80% are 1 time throw away variables.
Granted after becoming radioactive I only have a half-life!

FellippeHeitor

  • Guest
Re: Lacking QB4.5 error catch
« Reply #5 on: December 16, 2021, 07:10:21 pm »
Every Choice Is A Renunciation.

FellippeHeitor

  • Guest
Re: Lacking QB4.5 error catch
« Reply #6 on: December 16, 2021, 07:10:52 pm »
BTW, the title of the thread is now misleading, it seems.

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: Lacking QB4.5 error catch
« Reply #7 on: December 16, 2021, 09:24:19 pm »
BTW, the title of the thread is now misleading, it seems.
Honestly, not really, SYSTEM seems a better option to have the return value with, as it not only ends execution of the program but returns control to the system.
Where as END just ends execution of the program but doesn't grant the system control until the user presses a key.
and it is a situation caught in QB45, even if QB64 doesn't care, so the title is correct if not precise.

But whatever cause I know my little opinion on the matter has no more worth than sand in the Sahara.
(take that back, apparently sand from the Sahara is quite expensive!! at $31US for 60g!!)
Granted after becoming radioactive I only have a half-life!

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Lacking QB4.5 error catch
« Reply #8 on: December 24, 2021, 05:21:42 am »
@Cobalt
Is there  a price also for sand of Gobi desert?


@FellippeHeitor

Quote
Back in QB4.5 these two commands wouldn't take parameters. Microsoft only fixed that with v7.1.

it seems that Microsoft QuickBasic project managers had made changes so much in QuickBasic going from 4.5 to 7.1 (ISAM, memory allocation and managment, some features about string variables, and now you teach me also about END and SYSTEM).

Seeing the matter from a C pointview (using the glasses of C concepts) I can agree that these news about END and SYSTEM are a fix (the application when returns no value is like a SUB, while when the application returns a value to the OS it is like a FUNCTION... it seems like  main VOID vs main INT).
In this perspective QB64 is nearer to QB PDS than QB4.5, like for _PRESERVE that is a keyword of QB PDS.

PS:
@ FellippeHetoir
again that issue on replying to a post. If I go out of time, going to login again I find myself into a page for NewThread post .
I report this if it can be useful.
Programming isn't difficult, only it's  consuming time and coffee