Questions tagged [function-call]

A function call is a line of code that executes a specific block of code defined as a function, that is, self-contained code that may optionally take arguments, defined for the purpose of code reuse.

A function call is a line of code that executes a specific block of code defined as a function, that is, self-contained code that may optionally take arguments, defined for the purpose of code reuse.

760 questions
9
votes
0 answers

R: Getting more informative error messages in R

I am still not very good at using R’s standard debugging tools, and I often find that neither the error nor the traceback tell me enough to figure out what is going on. I would like to change R’s default behavior on error to provide more…
andrewH
  • 2,281
  • 2
  • 22
  • 32
9
votes
3 answers

Invoke a function which is received as an interface variable in golang

I have a code which is similar to the following package main import "fmt" func PrintThis(arg string) { fmt.Printf("I'm printing %s", arg) } func PrintThisAndThat(arg1, arg2 string) { fmt.Printf("Now printing %s and %s", arg1,…
Manu Viswam
  • 1,606
  • 2
  • 18
  • 33
9
votes
3 answers

Skip function if it takes too long

In Java I have a function that processes a text file in a certain way. However, if it takes too much time the process will most likely be useless (whatever the reason is) for that text file and I would like to skip it. Furthermore, if the process…
Tim
  • 2,000
  • 4
  • 27
  • 45
8
votes
6 answers

Is it possible to skip parameters that have default values in a function call?

I have this: function foo($a='apple', $b='brown', $c='Capulet') { // do something } Is something like this possible: foo('aardvark', , 'Montague');
sprugman
  • 19,351
  • 35
  • 110
  • 163
8
votes
2 answers

The efficiency when using a big data structure in a function in Python

I need to use a big data structure, more specifically, a big dictionary to do the looking up job. At the very first my code is like this: #build the dictionary blablabla #look up some information in the ditionary blablabla As I need to look up…
ibread
  • 1,165
  • 1
  • 10
  • 18
8
votes
5 answers

Meaning of === with function call

I had been going through the ES6 assuming that it would be easy to switch to EcmaScript 2017. While going through, I got confused about this code function f (x, y = 7, z = 42) { return x + y + z } f(1) === 50 Which has ES5 equivalent function…
Tirthraj Barot
  • 2,671
  • 2
  • 17
  • 33
8
votes
2 answers

C function call selection using ternary operator

I have two C functions f1 and f2 that take the same arguments. Based on a condition, I need to invoke one or the other one with the same arguments: if (condition) { result = f1(a, b, c); } else { result = f2(a, b, c); } I understand it is…
enrico.bacis
  • 30,497
  • 10
  • 86
  • 115
7
votes
2 answers

How can I invoke a function that returns a lambda which also accepts another lambda as its parameter ( () -> Unit ) -> Unit in Kotlin?

The Code A is from the question answered by Roman Y. The Code A can work well when it invokes with background(appState)() {...}, why can't I remove parentheses ()? But Code B fails when it invoke with background(appState) {...}, why? And more Code C…
7
votes
2 answers

Why is my program evaluating arguments right-to-left?

I am learning C so I tried the below code and am getting an output of 7,6 instead of 6,7. Why? #include int f1(int); void main() { int b = 5; printf("%d,%d", f1(b), f1(b)); } int f1(int b) { static int n = 5; n++; …
7
votes
2 answers

Unpack an array of arguments for a function call

Is it possible to pass a function and a list of its arguments to another function and call it from inside later on? void testA(int, float, char* ) {} void testB(int, float, double ) {} void testC(MyClass, float, double ) {} template
WrathOfFlame
  • 83
  • 1
  • 7
7
votes
3 answers

why it is allowed to pass insufficient number of parameters when calling a function in C?

I know that function prototyping is mandatory in C++ if the function is defined after the main() function, but it is optional (but recommended) in C. I recently wrote a simple program that performs addition of 2 numbers, but by mistake used the dot…
Destructor
  • 14,123
  • 11
  • 61
  • 126
7
votes
4 answers

How to call Java function from string stored in a Variable

Possible Duplicate: Calling a method named “string” at runtime in Java and C I need to be able to call a function, but the function name is stored in a variable, is this possible. e.g: public void foo () { //code here } public void bar…
Lizard
  • 43,732
  • 39
  • 106
  • 167
7
votes
2 answers

javascript "this" points to Window object again

I asked a question on Javascript this points to Window object regarding "this" points to Window object. here is source code var archive = function(){} archive.prototype.action = { test: function(callback){ callback(); }, …
Moon
  • 22,195
  • 68
  • 188
  • 269
6
votes
7 answers

Is sizeof a function or an operator?

Why do we say sizeof(variable) is an operator, not a function? It looks like a function call and when I am thinking about the meaning of operator, it appears to me something like + or - or * and so on
Run
  • 130
  • 6
6
votes
1 answer

Default argument and parameter promotions in C

I was studying about default argument promotions and got stuck at one point. In C 2011 (ISO/IEC 9899:2011), the relevant part seem to be: §6.5.2.2 Function calls ¶6 If the expression that denotes the called function has a type that does not…
LocalHost
  • 910
  • 3
  • 8
  • 24
1 2
3
50 51