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
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
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.



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
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 27th Mar 2014 11:43
Agreed.



Powered by Free Banners

Login to post a reply

Server time is: 2024-04-26 15:54:28
Your offset time is: 2024-04-26 15:54:28