|
-
Jul 27th, 2006, 08:29 AM
#1
Thread Starter
Addicted Member
Use of the CALL keyword
This is a general question regarding the use of the CALL keyword...
I'm not referning to external procs, but rather to internal or intrinsic procs.
I have read that the use of the keyword CALL is considered to be obsolete and to have detrimental effects on the operation of the application.
Does anyone have any specific insight as to whether this is right or wrong, and what these effects might be?
Simple minded Example:
Msgbox "OK"
vs
CALL Msgbox("OK")
-
Jul 27th, 2006, 08:30 AM
#2
Re: Use of the CALL keyword
I have not known Call to have a determental effect.
It is included with the language more for backward compatibility than practical use however.
-
Jul 27th, 2006, 08:37 AM
#3
Re: Use of the CALL keyword
Please check Call statement thread.
-
Jul 27th, 2006, 08:40 AM
#4
Re: Use of the CALL keyword
The difference is purely syntactic.
In VB6 calling a procedure without trapping its return value means you do not use the parentheses around the argument list.
VB Code:
MySub arg1, arg2
' vs.
ret = MyFunc(arg1, arg2)
Call allows you to call a Sub, or call a function without trapping its return value, and use the argument parentheses as well.
Make of it what you wish, I think it's fairly pointless.
BTW in VB.NET both types of procedure call can be effected using the argument parentheses now, so in VB.NET the Call keyword truely is obsolete.
-
Jul 27th, 2006, 08:42 AM
#5
Re: Use of the CALL keyword
 Originally Posted by penagate
BTW in VB.NET both types of procedure call can be effected using the argument parentheses now, so in VB.NET the Call keyword truely is obsolete.
As it probably should have been in VB6.
-
Jul 27th, 2006, 08:53 AM
#6
Frenzied Member
Re: Use of the CALL keyword
I'e noticed this in the past, and never really knew the difference between
as opposed to
I think some people like to use it as it "stands out" a bit more that the code is calling another routine.
-
Jul 27th, 2006, 09:09 AM
#7
Fanatic Member
Re: Use of the CALL keyword
What about if you want to call a process without passing it any arguments, would it be better to use Something() than to use Call Something?
-
Jul 27th, 2006, 09:11 AM
#8
Re: Use of the CALL keyword
 Originally Posted by shirazamod
What about if you want to call a process without passing it any arguments, would it be better to use Something() than to use Call Something?
It doesn't matter. Both of these will execute whatever code is in the Something Sub
VB Code:
Private Sub Command1_Click()
Something
End Sub
Private Sub Command1_Click()
Call Something
End Sub
-
Jul 27th, 2006, 09:12 AM
#9
Re: Use of the CALL keyword
Apart from the fact that you can't actually do Something(), only Something, like I said there's no difference.
In VB.NET, and other languages, it would be Something(), yes.
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
|