473,382 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Call: Is it necessary?

lotus18
866 512MB
Hello World

Using a Call is it necessary? You can call a function without using that keyword right? Second question, which performs faster, using a Call or not?

Rey Sean
Jan 28 '08 #1
11 1437
debasisdas
8,127 Expert 4TB
Specifying CALL is optional and is agood practise to use in programming.

That does not involve any performance issue.
Jan 28 '08 #2
Killer42
8,435 Expert 8TB
Specifying CALL ... is agood practise to use in programming.
That is entirely a matter of opinion. You would hardly expect to use CALL before every statement, so why pick out particular ones?

Surely the whole point of an extensible language is that the extensions are integrated into it seamlessly, and don't require special coding to use.
Jan 29 '08 #3
cugone
20
Using the Call statement is more of a readability preference than anything.

Be aware though, that it's only safe to use it on Subroutines, not Functions, as when it's used on Functions it causes the returned value to be ignored.
Jan 29 '08 #4
Killer42
8,435 Expert 8TB
Using the Call statement is more of a readability preference than anything.
I'm curious about which way you mean that. I generally find the code much more readable without the Call.
Jan 29 '08 #5
debasisdas
8,127 Expert 4TB
My understanding is CALL should be used to call sub procedures not other event procedures and functions.

It make the code more readable in the sense that while going through the code it can be easily find out . It specifies that anything following that keyword is a sub procedure. It specially comes handy while someone else is going through your code. Specially in maintenance projects.
Jan 29 '08 #6
lotus18
866 512MB
It specially comes handy while someone else is going through your code. Specially in maintenance projects.
You have the point. : )

Rey Sean
Jan 29 '08 #7
werks
220 100+
Hello World

Using a Call is it necessary? You can call a function without using that keyword right? Second question, which performs faster, using a Call or not?

Rey Sean
I agree with debasisdas, it is much easier to identify if you use Call


Better Than Yesterday ^^
Jan 29 '08 #8
jamesd0142
469 256MB
For what it's worth i agree with killer42, I prefer to read and write code without writing "call".

I believe it's a preference that will differ between programmers.

And here's my reason for posting:

Is it right if you use call to call a function the return value is ignored? I was unaware of this.

Does this not remove the whole point of calling a function?
Jan 29 '08 #9
Killer42
8,435 Expert 8TB
For what it's worth i agree with killer42, I prefer to read and write code without writing "call".

I believe it's a preference that will differ between programmers.
My point is that with an extensible language such as this, once you create a Sub or Function it effectively becomes part of the language. It's a "black box", presumed to have been tested and working. There should be no need to differentiate by using a special type of call. The name of the routine should be enough to tell you what it does. If there's any question about where the routine comes from, a simple keypress will tell you.

Is it right if you use call to call a function the return value is ignored? I was unaware of this.

Does this not remove the whole point of calling a function?
Well, yes and no. If you need the return value, then sure, it defeats the purpose. But keep in mind that since the function can contain any code you like, it may actually do something. You may want to treat it like a Sub in certain circumstances and not bother with a returned value.

The MsgBox function is a prime example. You can use it to prompt the user and determine what button they clicked. Or you can just show a message and wait for the user to click OK. Do you need to know that they clicked OK?

Examples...
Expand|Select|Wrap|Line Numbers
  1.   Dim UserResponse As Long
  2.  
  3.   ' Before performing some action...
  4.   UserResponse = MsgBox("Are you sure?", vbYesNoCancel, "Confirm Action")
  5.  
  6.   ' After performing some action...
  7.   MsgBox "Finished!"
  8.  
Jan 29 '08 #10
kadghar
1,295 Expert 1GB
Hope any of you know why this happens.
Feb 12 '08 #11
Killer42
8,435 Expert 8TB
Hope any of you know why this happens.
Yes, that was a very simple one. The OP had put unnecessary parentheses around the argument list in the "call". All they needed was to remove them.
Feb 12 '08 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: ip4ram | last post by:
I used to work with C and have a set of libraries which allocate multi-dimensional arrays(2 and 3) with single malloc call. data_type **myarray =...
39
by: Randell D. | last post by:
Folks, I'm sure this can be done legally, and not thru tricks of the trade - I hope someone can help. I'm writing a 'tool' (a function) which can be used generically in any of my projects. ...
4
by: Christian | last post by:
From a not even newbie: Without knowing much about Python (yet) I'm trying to install the CMS Zope via FTP (with the well documented changes to make it work on an Apache server). By birth Zope...
24
by: Jazper | last post by:
hi i have this problem. i made a class deverted by CRootItem with implementation of IDisposable-Interface. i made a test-funktion to test my Dispose-Method.... but when set a breakpoint in my...
1
by: Robert Ludewig | last post by:
I have sucessfully imported and compiled a complex MFC 6.0 project from vc++6.0 (MFC6.0) into vc++ 8.0 (MFC 8.0). It contains several subprojects (libs and dlls). In vc++ 6.0 those project linked...
16
by: Jordan S. | last post by:
I have a VBScript that runs on the server. I want to call that script from an ASP.NET Web application. How can I do that? Thanks!
7
by: dragoncoder | last post by:
Hello experts, I have the following code me. =cat mystring.h #include<iostream> using namespace std; class mystring {
4
by: Frank Lund | last post by:
Should we call .Dispose() every chance we get... on every object that exposes .Dispose()... and every time we have such an object? For example, is it true that *every* time I create a DataTable...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.