Nested function definition

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
User avatar
Seb McClouth
Veteran
Posts: 342
Joined: Wed Nov 09, 2005 7:47 am
Location: Inside the Matrix...
Contact:

Nested function definition

Post by Seb McClouth »

While compiling the core, I'm getting a ' Nested function definition' error. I have no clue why.

Code is as following:

<code>SUB ctrlaltdel
...
END SUB
</code>

The declare is in a main file called LIBRARY.QH and in there everything is declared like it should.

<code>DECLARE SUB ctrlaltdel ()
</code>

Can someone help me out here?

grtz
Seb
QBinux is a Linux distribution with the aim of integrating the work of the vast community of free software developers at Pete's QBASIC Site in order to create a modern, performant, safe and easy to use system for system administrators and desktop users.
moneo
Veteran
Posts: 451
Joined: Tue Jun 28, 2005 7:00 pm
Location: Mexico City, Mexico

Re: Nested function definition

Post by moneo »

Seb McClouth wrote:While compiling the core, I'm getting a ' Nested function definition' error. I have no clue why.......
I had never heard of "nested function definition", but found that it is valid in other languages.

Perhaps the Function or SUB immediately before the Sub in question, did not terminate correctly with an End Function or End Sub. Sometimes we forget and use Exit Sub or Exit Function instead.

Another possibility is that the Sub in question is the first Sub after the main module. I have seen recommendations that say to terminate the main modile with an END before placing your Subs and Functions. As a result, I always do this. However I have seen programs that do not use this rule.

I couldn't find this error message in my QuickBasic manual. Sorry that I don't have anything more definitive.

Regards..... Moneo
*****
User avatar
Seb McClouth
Veteran
Posts: 342
Joined: Wed Nov 09, 2005 7:47 am
Location: Inside the Matrix...
Contact:

Post by Seb McClouth »

THx I'll check... btw does it apply to PDS as well your manual?
QBinux is a Linux distribution with the aim of integrating the work of the vast community of free software developers at Pete's QBASIC Site in order to create a modern, performant, safe and easy to use system for system administrators and desktop users.
User avatar
Seb McClouth
Veteran
Posts: 342
Joined: Wed Nov 09, 2005 7:47 am
Location: Inside the Matrix...
Contact:

Post by Seb McClouth »

Moneo, you were right. I did forget an END SUB in the sub before.
tHX
QBinux is a Linux distribution with the aim of integrating the work of the vast community of free software developers at Pete's QBASIC Site in order to create a modern, performant, safe and easy to use system for system administrators and desktop users.
moneo
Veteran
Posts: 451
Joined: Tue Jun 28, 2005 7:00 pm
Location: Mexico City, Mexico

Post by moneo »

Seb, great, glad you found it.

Actually my manual is for QuickBasic 4.0. I run 4.5 and use this manual because I found it more complete than the 4.5 manual. There is probably a lot of newer stuff covered by PDS which, of course, wouldn't be in this manual.

Regards..... Moneo
*****
User avatar
Seb McClouth
Veteran
Posts: 342
Joined: Wed Nov 09, 2005 7:47 am
Location: Inside the Matrix...
Contact:

Post by Seb McClouth »

Well, I wouldn't have found it, without your help.
I don't have any manual, just some old on a TRS-80... that covers... erm... no a GW-Basic as well...

grtz
QBinux is a Linux distribution with the aim of integrating the work of the vast community of free software developers at Pete's QBASIC Site in order to create a modern, performant, safe and easy to use system for system administrators and desktop users.
Post Reply