May 21, 2024, 07:41:40 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Just found a bug I have looked for for weeks

Started by Rock Ridge Farm (Larry), April 11, 2006, 06:15:27 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Rock Ridge Farm (Larry)

I had a problem with some code I was working on. I finally found it.
It was a missing 'return' statement in a subroutine. From my 'C' days I made the mistake
of thinking that 'return' was implied - what I found out was that if a class procedure call a subroutine
a 'return' statement is required. I guess this is the way Aurora (or OOP) works??????
I will now put 'return' at the end of all my routines now.

Ionic Wind Support Team

A return is automatically inserted if one hasn't been used yet.  If you have multiple return statements you'll need to add the last one.

sub blah
{
if(a=0)
     return -1;
...
return 0;
}

Ionic Wind Support Team

Rock Ridge Farm (Larry)


Mike Stefanik

It's one thing that I hope is addressed before release. I believe it should always do an implicit return at the end of the function (regardless if the user has specified one or not). The ability "fall through" functions is just not safe, and creates annoyingly hard to find bugs, particularly if you're a C/C++ programmer.
Mike Stefanik
www.catalyst.com
Catalyst Development Corporation

Rock Ridge Farm (Larry)

Or at least the compiler should complain. Just my opinion.