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
4
votes
2 answers
Division ("/") in function
I'm trying to write a simple function of the division, but I get an error
PS C:\Users\john> Function Div($x, $y) { $x / $y }
PS C:\Users\john> Div (1, 1)
Method invocation failed because [System.Object[]] doesn't contain a method named…

Loom
- 9,768
- 22
- 60
- 112
4
votes
3 answers
Variable-length by-ref argument lists in functions
In PHP you can do this:
function something() {
foreach (func_get_args() as $arg)
echo $arg;
}
something(1, 3); //echoes "13"
This works fine for arguments passed by value, but what if I want them to be passed by reference? like this:
function…

cambraca
- 27,014
- 16
- 68
- 99
4
votes
1 answer
Scheduling child activity that implements an interface with input parameters
public sealed class Parent : NativeActivity
{
public Parent()
{
Childrens = new Collection();
Variables = new Collection();
_currentActivityIndex = new Variable();
…

Davi Fiamenghi
- 1,237
- 12
- 28
4
votes
2 answers
Is there any easier way of creating overload for methods in C#?
This is a general programming doubt rather than a specific one. But I would state it with an example. Suppose I'm creating a MessageBox class of mine own, and I want .Show() method to be implemented with say 21 overloads. I can do this like shown…

nawfal
- 70,104
- 56
- 326
- 368
4
votes
2 answers
Understanding the return value of spawn
I'm getting started with Erlang, and could use a little help understanding the different results when applying the PID returned from spawn/3 to the process_info/1 method.
Given this simple code where the a/0 function is exported, which simply…

user113716
- 318,772
- 63
- 451
- 440
4
votes
4 answers
Which identifier variable is better to pass as an argument to a method?
Suppose the following method:
public void ShareClassStuff(int shareClassId)
{
var shareClass = _shareClassService.GetShareClassById(shareClassId);
(if shareClass != null)
var shareClassStat =…

DaveDev
- 41,155
- 72
- 223
- 385
4
votes
2 answers
How many arguments is a reasonable number, big objects vs atomic arguments. OOP
i'm a novel developer and i would like to know in yours experience what is the better approach when your building class methods, and if there is not a better approach, how balance your decisions with respect to:
Pass as arguments a big object that…

mjsr
- 7,410
- 18
- 57
- 83
4
votes
1 answer
static method as default parameter to a class method
My question is about two answers to another question: Using class/static methods as default parameter values within methods of the same class.
I am trying to understand if there's really a difference between what the two answers do, and if so,…

max
- 49,282
- 56
- 208
- 355
4
votes
1 answer
Is there a way to pass arguments using the dot operator in python?
I'd like to the make a clean, "smart" method that performs specific operations without passing in arguments. I have some code that works in principle as follows:
class Foo():
def __init__(self, spam='spam', ham='ham'):
self.spam = spam
…

pylang
- 40,867
- 14
- 129
- 121
4
votes
4 answers
Why is a function not serializable?
Background
In the Meteor docs for Meteor.call(), it reads:
If you include a callback function as the last argument (which can't be an argument to the method, since functions aren't serializable)...
I have ran something similar to…

dayuloli
- 16,205
- 16
- 71
- 126
4
votes
1 answer
Does Fortran intent(inout) pass a copy of the value, or pointer/reference to RAM address?
As title states I wish to know does Fortran intent(inout) pass a copy of the value, or a pointer/reference to RAM address? The reason I need to know this is I need to pass a (relatively) big data matrix. If it creates a local copy that would cause…

Jason Lee
- 59
- 4
4
votes
2 answers
How to Use an Environment Variable as an Environment Variable Name
In my pursuit of a solution to another environment-variable/batch-file related problem, I have once again come across a problem I have visited before (but cannot for the life of me remember how, or even if I solved it).
Say you have two BAT files…

Synetech
- 9,643
- 9
- 64
- 96
4
votes
2 answers
How to pass char array from C JNI function to Java method as byte[]
I'm having trouble finding the right documentation for passing a char buffer from JNI method to Java method. Here's the code
jint JNICALL Java_foo_package_MyJavaClass_myNativeMethod(JNIEnv *jenv, jobject jobj)
{
jclass clazz =…

hyde
- 60,639
- 21
- 115
- 176
4
votes
1 answer
Usage of WiFi-Direct in Game Development (Android)
I am developing board game in android. I want to make this game playable on two separate devices, for that I need to use WiFi-Direct. I want to know is there any library available which will help me to
Find and connect with device
Send and receive…

Umar Farooq
- 127
- 1
- 2
- 19
4
votes
1 answer
VB.NET: Sending Multiple Arguments To a Background Worker
I am trying to use a BackgroundWorker to perform tasks on a separate thread.
I am able to pass a single argument to the BackgroundWorker as below:
Send argument to BackgroundWorker:
Private Sub btnPerformTasks_Click(sender As System.Object, e As…

slayernoah
- 4,382
- 11
- 42
- 73