Page 1 of 1

Nested function definition

Posted: Mon Jul 03, 2006 11:08 am
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

Re: Nested function definition

Posted: Mon Jul 03, 2006 2:39 pm
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
*****

Posted: Mon Jul 03, 2006 3:08 pm
by Seb McClouth
THx I'll check... btw does it apply to PDS as well your manual?

Posted: Mon Jul 03, 2006 3:08 pm
by Seb McClouth
Moneo, you were right. I did forget an END SUB in the sub before.
tHX

Posted: Mon Jul 03, 2006 4:53 pm
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
*****

Posted: Tue Jul 04, 2006 10:50 am
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