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
13
votes
5 answers

Difference between calling of virtual function and non virtual function?

This is in fact an interview question, I can't figure out the answer. Anyone knows about this? You can talk about any difference, for example, the data that are push into stack.
cheng
  • 2,106
  • 6
  • 28
  • 36
13
votes
2 answers

What is the difference between onClick="javascript: function('value')'" and onClick="function('value');"?

What is the difference between the following? onClick="javascript: function('value');" onClick="function('value');" When do I use the javascript: before the function call, and why? Can I call the function without using javascript: prefix? Please…
Jalpesh Patel
  • 3,150
  • 10
  • 44
  • 68
12
votes
2 answers

Function arguments push order

Why are function arguments pushed on the stack in right to left order?
Rajendra Uppal
  • 19,218
  • 15
  • 59
  • 57
12
votes
4 answers

What is the difference between the function calls “mail()” and “@mail()”?

I am writing a PHP mail function and some examples have @mail(…) and others have just mail(…). What is the difference and which one is best to use? Cheers
Designer023
  • 1,902
  • 1
  • 26
  • 43
12
votes
6 answers

What is a callback function and how do I use it with OOP

I want to use the php simple HTML DOM parser to grab the image, title, date, and description from each article on a page full of articles. When looking at the API I notice it has a set_callback which Sets a callback function. However im not sure…
Paul M
  • 3,937
  • 9
  • 45
  • 53
12
votes
3 answers

javascript function running without being called

I wonder why, as soon as the page loads, the function btw_bijtellen () is called. I wanted to call it by clicking... var $ = function (id) { return document.getElementById (id); } function btw_bijtellen () { window.alert("we want to…
pwp
  • 159
  • 1
  • 1
  • 9
11
votes
2 answers

How to call C# DLL function from VBScript

I have my script on server, so I do not have UI interaction available and have to use DLL instead of console application. How to call a function in C# DLL from VBScript? How do I make my DLL to be COMVisible? Do I have to register it?
abatishchev
  • 98,240
  • 88
  • 296
  • 433
11
votes
3 answers

Is it possible to emulate a function using your own data type?

Is it possible to emulate a function with your own data type with some GHC extension? What I want to do is e.g. (imaginary syntax) data MyFunc = MyFunc String (Int->Int) instance (Int->Int) MyFunc where ($) (MyFunc _ f) i = f i inc = MyFunc…
shang
  • 24,642
  • 3
  • 58
  • 86
10
votes
2 answers

'Spread' parameters in Scala?

Is there any way to call a Scala function that takes individual parameters, given an array (similar to JavaScript Spreads in ECMAScript 6)? ys = [10.0, 2.72, -3.14] f(x, ...ys); The cleanest syntax would be: f(1, ys) but that does not appear to…
Brent Faust
  • 9,103
  • 6
  • 53
  • 57
9
votes
6 answers

Is it a sin to use infinite recursion for infinite loops in Python?

This question is more about curiosity than utility. If I'm writing a function that's supposed to run for ever, for instance a daemon, how would Python handle it if I called the function again from the end of the function? def daemonLoop(): #…
Hubro
  • 56,214
  • 69
  • 228
  • 381
9
votes
16 answers

Any programming language with "strange" function call?

I was wondering, is there any programming language where you can have function calls like this: function_name(parameter1)function_name_continued(parameter2); or …
functional
9
votes
2 answers

Precedence of a function call in R

On the standard R help page for operator precedence, they do not include function calls, which seems rather sloppy in my opinion. This was causing me some problems so I decided to just use trial-and-error with substitute and found that the…
Jon Claus
  • 2,862
  • 4
  • 22
  • 33
9
votes
3 answers

Inexplicable expense related to getting data out of a function in optimized and timed C++ code

I have written optimized code for an algorithm that computes a vector of quantities. I have timed it before and after various attempts at getting the data computed in the function out of the function. I think that the specific nature of the…
rg6
  • 329
  • 2
  • 10
9
votes
3 answers

Undefined behavior: when attempting to access the result of function call

The following compiles and prints "string" as an output. #include struct S { int x; char c[7]; }; struct S bar() { struct S s = {42, "string"}; return s; } int main() { printf("%s", bar().c); } Apparently this seems to…
cpx
  • 17,009
  • 20
  • 87
  • 142
8
votes
1 answer

Passing values directly as array to function in C

I have a function which accepts an integer array as argument and print it. void printArray(int arr[3]) { int i; for(i=0; i<3; ++i) { printf("\n%d", arr[i]); } } Is there a way to pass the values of the array like this printArray(…
J...S
  • 5,079
  • 1
  • 20
  • 35
1
2
3
23 24