Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Bug Reports / DBP 7.7 Function AS TYPE causes bizarre runtime behavior

Author
Message
BMacZero
11
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ N_America/ USA/ CA/ South
Posted: 26th Mar 2014 00:15
I was recently trying to get a function to return a UDT. I've since read that this is actually impossible - however, the DBP compiler seems to have no problem with the following syntax:
function myFunction() as Type

The following code indicates that the as Type declaration is actually being applied to the last parameter of the function, even though the type name is outside the closing paren. The print y line in myFunction prints garbage.

+ Code Snippet

Expected behavior: Type declarations after the closing paren shouldn't be applied to the last parameter. Instead, the compiler should warn that functions can't return user-defined types.

Green Gandalf
12
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 27th Mar 2014 11:43
Agreed.



Powered by Free Banners

Login to post a reply

Server time is: 2017-03-23 02:18:11
Your offset time is: 2017-03-23 02:18:11