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
8
votes
4 answers

Implicit declaration of function "..." is invalid in C99?

I'm trying to declare a function within another function. So here's part of my code: ViewController.m - (void)updatedisplay{ [_displayText setText:[NSString stringWithFormat:@"%d", counter]]; } - (IBAction)minus1:(id)sender { counter--; …
Rouvis
  • 159
  • 1
  • 1
  • 10
8
votes
4 answers

Difference between ISR and Function Call?

I want to understand difference between ISR (Interrupt Service Routine) and Function call. I feel both the function call and ISR are the same from the hardware perspective. Please Correct me if I am wrong. All I could found about ISR and Function…
8
votes
4 answers

how do procedure calls work in assembler?

I just started tinkering with ASM and I'm not sure if my understanding of procedure calls is correct. say at some point in the code there is a procedure call call dword ptr[123] and the procedure consists of only one command, ret: ret 0004 what…
int3
  • 12,861
  • 8
  • 51
  • 80
7
votes
5 answers

Passing Function name as arguments to a function

Is it possible to pass the name of a function(say A) as an argument to another function (say B), and then call function A from function B. That is the function name will be stored in a variable in B, and using it call the function whose name is in…
Balanivash
  • 6,709
  • 9
  • 32
  • 48
7
votes
2 answers

Confusion around function call resolution

This question is inspired by this one. Consider the code: namespace ns { template void swap(T& a, T& b) { using namespace std; swap(a, b); } } After some test with GCC, I found that swap(a, b); resolves to 1) std::swap if…
7
votes
1 answer

IE operating faster with function calls?

Looking for ways to optomize my code, I happened upon this jsPerf test. Not expecting anything other than to have my notion of the slowness of function calls reaffirmed, my results with IE 9 really threw me for a loop. Code which utilized function…
Trey Keown
  • 1,345
  • 3
  • 16
  • 23
6
votes
5 answers

arguments are reversed for a C function

I have a function that multiply two matrices A and B then prints the result. I got two different outputs when running the program in two similar ways. first: FILE *f; f = fopen("in.txt","r"); struct Mat* A = read_mat(f); struct Mat*…
M.ElSaka
  • 1,264
  • 13
  • 20
6
votes
2 answers

PHP: call_user_func_array: pass by reference issue

The below function generates error when a function contains referenced arguments eg: function test(&$arg, &$arg2) { // some code } Now I can not use call_user_func_array for above function, it will generate an error. How to solve this problem? I…
Sarfraz
  • 377,238
  • 77
  • 533
  • 578
6
votes
1 answer

Doxygen to document all functions in a class with call graph?

What would be the best way to figure out all the calls made in a C++ class? I would like to not only find all the calls, I want to find out functions that aren't being called at all so I could clean up my code. I have heard that doxygen can work…
user1496542
  • 539
  • 2
  • 6
  • 14
5
votes
7 answers

performance implications of global variables in c

I have 5 functions which gets called 10000+ times (on an average). All of them modifies/uses certain variables. I know it is bad practice to have global variables. But for performance sake, does it make sense to keep them global and not pass them…
hari
  • 9,439
  • 27
  • 76
  • 110
5
votes
2 answers

C - Output explanation of printf("%d %d\n",k=1,k=3);

How to explain the output of the below code: include int main(void) { int k; printf("%d %d\n",k=1,k=3); return 0; } Ideone Link My thinking was that 1 will be assigned to k variable and then 1 would be printed. Similarly 3…
5
votes
1 answer

`this` keyword equivalent in delphi

Let's say that we have this class: unit Traitement; interface type TTraitement =class public function func1(param:String): String; function func2(param:String): String; end; implementation function…
Billydan
  • 395
  • 1
  • 7
  • 25
5
votes
4 answers

Does over-using function calls affect performance? Specifically in Fortran

I habitually write code with lots of functions, I find it makes it clearer. But now I'm writing some code in Fortran which needs to be very efficient, and I'm wondering whether over-using functions will slow it down, or whether the compiler will…
Samizdis
  • 1,591
  • 1
  • 17
  • 33
5
votes
1 answer

how rsp is decremented in prologue on a X86-64 architecture

I am trying to understand how functions are called in C. When I disassemble this code (gcc - gdb; I am on Linux with an i5-3320M) to get the prologue of function toto: void nop(){return ;} void toto(int i, int j) { return; } int main(int argc,…
5
votes
4 answers

Call a function by an external application without opening a new instance of Matlab

Is there a way to call Matlab functions from outside, in particular by the Windows cmd (but also the Linux terminal, LUA-scripts, etc...), WITHOUT opening a new instance of Matlab each time? for example in cmd: matlab -sd myCurrentDirectory -r…
Robert Seifert
  • 25,078
  • 11
  • 68
  • 113
1 2
3
23 24