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
3 answers
Sending an NSMutable Array to a php script in iOS
I am making an iPhone app which needs to send a couple of arrays to a php script and then the php script needs to take the value(s) of those arrays and write an xml file. I know how to write the xml file with php, but I am unsure how to send the…

thebiglebowski11
- 1,451
- 10
- 41
- 76
3
votes
3 answers
Passing volatile array to strncpy
In my ISR I have a buffer that gets stuffed from the USART so I declared the buffer as volatile:
volatile uint8_t RxBuffer1[BUFFER_LENGTH];
Ok, no problem there. I believe that is standard practice.
Somewhere in main() I need to copy a portion of…

user1160866
- 157
- 2
- 10
3
votes
5 answers
What is the neatest way of passing flags to a Matlab function?
I'm designing a function that takes as argument one structure and any number of flags. The function will contain a couple of ifs checking whether a specific flag is set.
What is the neatest way to achieve this? I was thinking about passing the flags…

Tim
- 13,904
- 10
- 69
- 101
3
votes
2 answers
Pass optional argument from parent to child in Ruby
There must be a DRY way to do this without two separate calls to File.open, and without peeking at what File.open's default value for permissions is. Right?
def ensure_file(path, contents, permissions=nil)
if permissions.nil?
File.open(path,…

Jay Levitt
- 1,680
- 1
- 19
- 28
3
votes
1 answer
Global variables and arguments in matlab, which is fastest?
I am using a recursive function in Matlab where some variable are required at each level, these don't change. Though some do change in functions and also need to be reflected in main program.
I'd like to know which is best:
To define variables…

prateek
- 31
- 3
3
votes
5 answers
Should I be using global variables or passing the variables in java?
I'm creating a 2d tile based sim game.
I have a 2d array of gridSquares, which are accessed and changed from many different classes and methods.
Should I pass the 2d array of gridSquares each time, or make it a global? Which is best practice?
I was…

Relequestual
- 11,631
- 6
- 47
- 83
3
votes
1 answer
Pass method as argument
can I pass a method as an argument?
I don't succeed to pass the method targetOpenView in the example below:
-(void) targetTimeView:(id)sender {
[self TimeViewWithtimeInterval:.6 selector:targetOpenView]; //targetOpenView does NOT…

html_programmer
- 18,126
- 18
- 85
- 158
3
votes
2 answers
SASS Mixin Arguments
I am passing multiple arguments in the mixin below. I am calling the mixin from multiple places in my CSS files; sometimes all the args need to be specified, other times only a few. Ruby allows you to pass an optional args using a hash. Is there…

keruilin
- 16,782
- 34
- 108
- 175
3
votes
1 answer
Passing optional path arguments to ant
I have an ant task that uses an apply task to run a script on a group of files.
I have a directory structure resultant of something like this:
mkdir -p a/{b,c,d,e}/f
Normally (if I pass no arguments), I would like ant to run on all fs.
That is, if I…

yarian
- 5,922
- 3
- 34
- 48
3
votes
4 answers
How to call overloaded methods having optional parameters without ambiguity for compiler?
I have a static function in a class with two overloads. Both the overloads are quite the same with the exception of one or two parameters. string body is the only necessary parameter in my function which you can see, rest are optional parameters.…

nawfal
- 70,104
- 56
- 326
- 368
3
votes
4 answers
Passing Enumerations in a Function that's in a Struct (in C)
I have looked up how to pass an enumeration in a function, but that method doesn't work when both the function and enumeration are declared in a structure. Here is my code :
test_setup.h:
1 #ifndef TEST_SETUP_H_
2 #define TEST_SETUP_H_
…

Alex Brooks
- 1,151
- 1
- 10
- 39
3
votes
1 answer
inside a macro, can I have ,var evaluate to blank/nothing?
Thanks to previous answers on common lisp: how can a macro define other methods/macros with programmatically generated names? I have a macro that defines helper functions (actually I have a macrolet, my new favorite lisp-newbie-hammer). But inside…

nil
- 161
- 3
3
votes
6 answers
Pass contents of stringstream to function taking char* as argument
I have a function for writing ppm files (a picture format) to disk. It takes the filename as a char* array. In my main function, I put together a filename using a stringstream and the << operator. Then, I want to pass the results of this to my ppm…

SSilk
- 2,433
- 7
- 29
- 44
3
votes
5 answers
printf as argument of function
Usually usage of function:
my_func("test");
Whether I can use this parameter so?
my_func(printf("current_count_%d",ad_id));
int my_func(const char *key)

Bdfy
- 23,141
- 55
- 131
- 179
3
votes
2 answers
powershell pass system.object[] without unrolling
any ideas on how I can pass the Get-PSCallStack with out having it unroll. It appears to be a system.object[] but from what i have read online they don't remain intact when passed and " unroll ". I tried placing a comma in front to prevent it but…

alphadev
- 1,529
- 5
- 18
- 20