Questions tagged [function-calls]

Function (or method) calling is the act of using a function or a method.

Functions (or methods) are blocks of code.
They are there, ready to perform some action (a sequence of instructions, including the possibility of calling other functions - even themselves, which is called recursion).
If nobody calls them, the are useless (dead code).

351 questions
268
votes
14 answers

Function overloading by return type?

Why don't more mainstream statically typed languages support function/method overloading by return type? I can't think of any that do. It seems no less useful or reasonable than supporting overload by parameter type. How come it's so much less…
dsimcha
  • 67,514
  • 53
  • 213
  • 334
164
votes
5 answers

Calling a function from a string in C#

I know in php you are able to make a call like: $function_name = 'hello'; $function_name(); function hello() { echo 'hello'; } Is this possible in .Net?
Jeremy Boyd
  • 5,245
  • 7
  • 33
  • 57
103
votes
8 answers

php: determine where function was called from

is there a way to find out, where a function in PHP was called from? example: function epic() { fail(); } function fail() { //at this point, how do i know, that epic() has called this function? }
pol_b
  • 1,031
  • 2
  • 8
  • 3
65
votes
11 answers

Calling a user defined function in jQuery

I am trying to call a user defined function in jQuery: $(document).ready(function() { $('#btnSun').click(function() { myFunction(); }); $.fn.myFunction = function() { alert('hi'); } });
user269867
  • 3,266
  • 9
  • 45
  • 65
39
votes
10 answers

System call vs Function call

What is the difference between a system call and a function call? Is fopen() a system call or a function call?
Ankur
  • 1,189
  • 4
  • 12
  • 12
34
votes
7 answers

What is the scope of a defaulted parameter in Python?

When you define a function in Python with an array parameter, what is the scope of that parameter? This example is taken from the Python tutorial: def f(a, L=[]): L.append(a) return L print f(1) print f(2) print f(3) Prints: [1] [1, 2] [1,…
charlie
  • 525
  • 4
  • 9
24
votes
3 answers

How to view JavaScript function calls as they occur

Is it possible to view JavaScript function calls in the browser's JavaScript console? I know you can view XHR, but can you view function calls? For example, I hover my mouse over some element on a page and a div pops up. I know there was a…
styfle
  • 22,361
  • 27
  • 86
  • 128
24
votes
2 answers

UML diagram for function calls

Which UML diagram is best suited for depicting function calls? Also are there any diagrams where we can also mention the parameters that we pass to the called functions?
Softice
  • 241
  • 1
  • 2
  • 3
21
votes
3 answers

Passing functions which have multiple return values as arguments in Python

So, Python functions can return multiple values. It struck me that it would be convenient (though a bit less readable) if the following were possible. a = [[1,2],[3,4]] def cord(): return 1, 1 def printa(y,x): print…
James
  • 2,626
  • 5
  • 37
  • 51
20
votes
6 answers

Is there a way to call multiple functions on the same object with one line?

Just trying to tidy up a program and was wondering if anyone could feed me some syntax sugar with regard to calling a member function on one queue multiple times on the same line. For example, changing: queue q; q.push(0); q.push(1); to…
user6836841
20
votes
4 answers

Passing missing argument from function to function in R

I’ve learned that it’s common practice to use optional arguments in function and check them with missing() (e.g. as discussed in SO 22024082) In this example round0 is the optional argument (I know, round0 could be defined as logical). foo =…
MarkusN
  • 3,051
  • 1
  • 18
  • 26
20
votes
1 answer

How to use 'hclust' as function call in R

I tried to construct the clustering method as function the following ways: mydata <- mtcars # Here I construct hclust as a function hclustfunc <- function(x) hclust(as.matrix(x),method="complete") # Define distance metric distfunc <- function(x)…
neversaint
  • 60,904
  • 137
  • 310
  • 477
16
votes
1 answer

Sequencing of function parameter destruction

According to C++14 [expr.call]/4: The lifetime of a parameter ends when the function in which it is defined returns. This seems to imply that a parameter's destructor must run before the code which called the function goes on to use the function's…
M.M
  • 138,810
  • 21
  • 208
  • 365
15
votes
3 answers

Passing keyword arguments to a function when local variable names are same as function parameter names

Is there a more succint way to write this? f(a=a, b=b, c=c, d=d, e=e) Background: I have a function with too many arguments f(a, b, c, d, e): pass I my program I have local variables that are named exactly same as the function parameters. a,…
Praveen Gollakota
  • 37,112
  • 11
  • 62
  • 61
15
votes
4 answers

Visual Studio - show all calls to a function in source code level

I am wondering if there is any way to list all the calls to a function in source code, so that I could see the dependencies if I modify that function. One method I use is to search the function name in the "Entire Solution" but I am looking for a…
Timothy Chung
  • 153
  • 1
  • 1
  • 4
1
2 3
23 24