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.

Newcomers DBPro Corner / Modifying a UDT's fields within a function

Author
Message
neilo
18
Years of Service
User Offline
Joined: 15th Feb 2006
Location: Sitting in front of my computer
Posted: 24th Mar 2007 13:10
I'm just trying to get my head around this.

If I pass a UDT into a function and modify a field within that function, the modification is lost when I exit the function, correct?

That is, even a UDT is passed "byval" rather than "byref" (to use some VB terminology).

Thanks,

Neil
wildbill
18
Years of Service
User Offline
Joined: 14th Apr 2006
Location:
Posted: 24th Mar 2007 14:46
Don't want to sound stuffy or any such thing, but why not test this for yourself. That is the only way to learn what you can and cannot do with things. Just display the values of the UDT and give it a try. I think you will find that UDTs are very friendly.
neilo
18
Years of Service
User Offline
Joined: 15th Feb 2006
Location: Sitting in front of my computer
Posted: 24th Mar 2007 23:41
Actually, I did try. I simply didn't believe the results I was seeing, that's all.

I'm a C/C++ programmer, and I kinda expected DBPro to work the same way. It's not, so I'm having to rethink my approach on a lot of things.

I've no problems with UDT's as such: they make writing almost any type of software easier. I'm missing methods etc. from C++... but DBPro isn't C++, so I've no reason to complain there. I'm just surprised that they are passed ByVal into a function.

Still, I've slept on it, and I've woken with a new approach to things, so it's no big deal.

Regards,

Neil

Login to post a reply

Server time is: 2024-09-25 19:17:44
Your offset time is: 2024-09-25 19:17:44