|
-
Mar 22nd, 2004, 09:29 PM
#1
Thread Starter
Addicted Member
ByRef ByVal Discrepancy
Not sure about this. According to VB5 Online help...
ByRef Optional. Indicates that the argument is passed by reference. ByRef is the default in Visual Basic.
According to Microsoft Website...
ByVal is default.
Which should I believe?
Last edited by EZapps; Mar 22nd, 2004 at 09:32 PM.
Never tie a rock to your ankle while randomly selecting stones to throw from high places.
-
Mar 22nd, 2004, 09:32 PM
#2
The picture isn't missing
byref is default.
What link did it say either? (ie: post both links)
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Mar 22nd, 2004, 09:37 PM
#3
Frenzied Member
If you're creating your fuctions, you should explicitly declare whether variables are passed ByRef or ByVal. It's a good habit to keep the guess work out.
-
Mar 22nd, 2004, 09:45 PM
#4
Thread Starter
Addicted Member
Never tie a rock to your ankle while randomly selecting stones to throw from high places.
-
Mar 22nd, 2004, 09:48 PM
#5
The picture isn't missing
you were looking at .NET documentation.
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Mar 22nd, 2004, 09:49 PM
#6
Thread Starter
Addicted Member
Shawn
Thanks. I agree... especially since there seems to be a lot of discrepency within Microsoft itself.
Never tie a rock to your ankle while randomly selecting stones to throw from high places.
-
Mar 22nd, 2004, 09:53 PM
#7
Thread Starter
Addicted Member
Buggy
That brings up a good point. If the default values change (as per MS whim) and we don't explicitly declare ByRef or ByVal, will our software fail???
Never tie a rock to your ankle while randomly selecting stones to throw from high places.
-
Mar 22nd, 2004, 10:02 PM
#8
Thread Starter
Addicted Member
To further explain...
Please correct me if I'm wrong, as I am quite often. My understanding is that once compiled, the software is converted to machine language... subordient to the machine and operating system it resides on.
If, by default, that operating system assumes ByVal (when not explicitly declared), what guarantees do I have that my program (written and compiled with VB5) will work on Windows 2003?
Never tie a rock to your ankle while randomly selecting stones to throw from high places.
-
Mar 22nd, 2004, 10:19 PM
#9
Frenzied Member
Your OS has nothing to do with how variables are passed, in respect to BV or BR. Your software will more than likely either fail or product bad output if you meant to pass BV but passed BR or vice versa.
I really really advise explicitly labeling your function decleration's parameters with either BV or BR.
-
Mar 22nd, 2004, 10:23 PM
#10
Thread Starter
Addicted Member
Thanks Shawn...
Your advice is well heeded. In the future, I'll pay more attention and leave less to chance.
Never tie a rock to your ankle while randomly selecting stones to throw from high places.
-
Mar 22nd, 2004, 10:26 PM
#11
Thread Starter
Addicted Member
Oh... Thanks to you also Buggy...
Your advice always seems solid!
Never tie a rock to your ankle while randomly selecting stones to throw from high places.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|