Argument-passing may refer to two different things: (1) the process of providing a program being started with some initial pieces of information (the arguments) on its command line; (2) the process of providing the initial values (the arguments) for the parameters of a function when it is called.
Questions tagged [argument-passing]
777 questions
3
votes
2 answers
pass multiple arguments from makefile
My task is to pass multiple arguments to one of my executable binary files.
For example, I have a binary which takes 6 arguments, so it works fine when I type:
./a.out 1 2 3 4 5 6
I want to do the same using a makefile so that when I type make…

Abhishek Gangwar
- 1,697
- 3
- 17
- 29
3
votes
2 answers
How to P/Invoke "__arglist" function?
Background:
I have written the following function in C++:
extern "C" __declspec(dllexport) int test(const char*, ...);
And I am using P/Invoke to call it from C#:
[DllImport("foo/bar.dll", EntryPoint = "test")]
public static unsafe extern int…

unknown6656
- 2,765
- 2
- 36
- 52
3
votes
1 answer
How to pass an argument with space from bash script to bash script?
I have a script the manipulates data, creates arguments and sends them to a second script. One of the arguments contains a space.
script1.sh:
args=()
args+=("A")
args+=("1 2")
args+=("B")
. script2.sh ${args[@]}
script2.sh:
for f in "$@"
do
echo…

AlikElzin-kilaka
- 34,335
- 35
- 194
- 277
3
votes
1 answer
Passing variadic template argument pack to next function
I have done my own reimplementation of printf() (classic) in my debugging code.
template
void Printf(wchar_t const * message, T value, Args ...args);
void Printf(wchar_t const * message);
void…

Antiusninja
- 157
- 1
- 17
3
votes
0 answers
Arguments keep Returning Empty
Hello I've been having this problem for months , so please somebody help, I am a beginner in developing apps for android , that's why i wasn't able to fix this.
The Problem:
Developing A Music Player, my problem is with the playlists and its…

most unique
- 55
- 7
3
votes
2 answers
How to put arguments in a function at run time?
So I am using execlp in my c++ program. execlp is of the form " int execlp(const char *file, const char *arg0,...,const char *argn)" meaning that it can take arbitrary amount of arguments. I just want to know that is there a way I can put arguments…

Fahad Ur Rehman
- 93
- 7
3
votes
2 answers
R: find the original name of a function passed as argument
I have functions f1 and f2 that are taking a function as argument, eg:
f1 <- function(FUN) {
...
}
f2 <- function(FUN) {
f1(FUN=FUN)
}
From inside function f1, I need to find back the original name of the function passed to f2, eg…

RockScience
- 17,932
- 26
- 89
- 125
3
votes
2 answers
Xpages Combobox setting values in managed bean
I am trying to pass arguments to a managed bean.
The bean is configured and works, has two methods "getResponsible" and "setResponsible".
Calling "myLookup.responsible" works.
I cannot pass arguments to my bean, and can't figure out why.
The…

Kermit
- 2,865
- 3
- 30
- 53
3
votes
2 answers
How to parse same argument twice or more than once to python script?
I have written a python script which uses argeparse module for handling arguments.
e.g.
Test_Dual.py -g Linux
Now, I want to give it two options for same argument, like
Test_Dual.py -g Linux -g ESX -g Windows
How can I do that?

akkidukes
- 189
- 1
- 1
- 9
3
votes
1 answer
Passing convention for callable parameters
A lot of places in the STL and elsewhere you see code like this:
template
void foo(Func f)
{
// ...
f();
}
i.e. the callable parameter f is passed by (copy of) value. Why is this seemingly preferred over typing the…

sdzivanovich
- 740
- 3
- 14
3
votes
5 answers
how to create a string literal as a function argument via string concatenation in c
I need to pass a string literal to a function
myfunction("arg1" DEF_CHAR "arg1");
now part of that constructed string literal needs to be a function return
stmp = createString();
myfunction("arg1" stmp "arg2"); //oh that doesn't work either
is…

Reed Debaets
- 482
- 1
- 6
- 18
3
votes
1 answer
Passing unique_ptr to library functions (FORTRAN function)
I am using LAPACK library to create a R-package using C++. I am using unique_ptr for defining the arrays as
unique_ptr my_arr(new double[arr_length]);
I then pass this unique_ptr to library function (FORTRAN function) which accepts…

user4043293
- 31
- 2
3
votes
1 answer
Why do disjunction and conjunction in words need parenthesis?
Disjunction and conjunction in words (or, and) in argument position require additional parentheses, as opposed to ||, &&.
def foo _; end
foo(1 || 2) # => Good
foo(1 or 2) # => Syntax error
foo((1 or 2)) # => Good
foo(1 && 2) # => Good
foo(1 and 2)…

sawa
- 165,429
- 45
- 277
- 381
3
votes
0 answers
PHP : passing empty arguments with Error / Exception handling
I'm trying to figure out what's better approach for argument passing to the class methods / standard functions.
Basically - if we use default null for each argument then we can validate them from within the method and throw an exception, but if we…

Spencer Mark
- 5,263
- 9
- 29
- 58
3
votes
3 answers
Using functors without default constructors for stl containers
I would like to use my own comparator for std::set, which needs a parameter to be passed to its constructor:
template class EpsCompare {
public:
EpsCompare(T input_eps) : _eps(input_eps) {};
bool operator() (const T &…

urps
- 366
- 1
- 4
- 13