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

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.

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

Powered by Free Banners

Login to post a reply

Server time is: 2019-06-19 07:04:45
Your offset time is: 2019-06-19 07:04:45