Questions tagged [argument-passing]

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.

777 questions
7
votes
2 answers

Argument forwarding in LLVM

I need some advice on "forwarding" arguments to a callee (in the LLVM-IR). Suppose I have a function F that is called at the beginning of all other functions in the module. From F I need to access (read) the arguments passed to its immediate…
CAFxX
  • 28,060
  • 6
  • 41
  • 66
7
votes
2 answers

CodeIgniter: Passing Arguments from View to Controller?

EDIT: With the code below now, I am unsure on how to print out the bookmarks and the tags correctly I’m completely new to CI and I have recently hit a road block. I’m very unsure how I would go about passing a function argument from the view file…
ritch
  • 1,760
  • 14
  • 37
  • 65
7
votes
11 answers

Javascript: passing multiple arguments as a single variable

is it possible to pass multiple arguments using a single variable? For example, if I wanted to do something like: function foo(x,y){ document.write("X is " + x); document.write("Y is " + y); } var bar = "0,10"; foo(bar); The example above…
user418797
  • 71
  • 1
  • 1
  • 2
7
votes
2 answers

TCL/Expect equivalent of Bash $@ or how to pass arguments to spawned process in TCL/Expect

If somebody wants to call external program (which was passed as a Bash argument) from Bash and also pass it command line options (which were also passed as a Bash arguments) the solution is fairy…
Wakan Tanka
  • 7,542
  • 16
  • 69
  • 122
7
votes
2 answers

In C# should I pass a parameter by value and return the same variable, or pass by reference?

In a C# program I've made a method that deletes an object from a list. The user enters the index of the item to be deleted, the user is then asked to confirm the deletion, and the item is removed from the list if the user confirms, otherwise the…
Ruben9922
  • 766
  • 1
  • 11
  • 16
7
votes
1 answer

Using callNextMethod() within accessor function in R

This is related to the following post Problems passing arguments with callNextMethod() in R I am writing accessors for two S4 classes, 'foo' and 'bar'. 'bar' inherits from foo and is extended only by a few slots. Instead of writing a full accessor…
Maxence
  • 83
  • 2
7
votes
3 answers

Is Passing Arguments to a method always ordered left to right in java?

I'll call a method with two arguments, but i'll use k++ like this: polygon.addPoint((int)rs.getDouble( k++),(int)rs.getDouble( k++ )); Actually i want to be sure that jvm executes first argument first, then the second one. If somehow the order will…
Ismail Yavuz
  • 6,727
  • 6
  • 29
  • 50
7
votes
4 answers

Passing parameters dynamically to variadic functions

I was wondering if there was any way to pass parameters dynamically to variadic functions. i.e. If I have a function int some_function (int a, int b, ...){/*blah*/} and I am accepting a bunch of values from the user, I want some way of passing…
tommobh
  • 71
  • 1
  • 2
7
votes
2 answers

How to pass an arbitrary method (or delegate) as parameter to a function?

I need to be able to pass an arbitrary method to some function myFunction: void myFunction(AnyFunc func) { ... } It should be possible to execute it with other static, instance, public or private methods or even…
Sergiy Belozorov
  • 5,856
  • 7
  • 40
  • 73
7
votes
2 answers

Pass Argument from VBS to VBA

I try to call a VBA subroutine from VBS with passing a string variable from VBS to VBA, but can't find the appropiate syntax: 'VBS: '------------------------ Option Explicit Set ArgObj = WScript.Arguments Dim strPath mystr = ArgObj(0)…
Kay
  • 2,702
  • 6
  • 32
  • 48
7
votes
1 answer

python: pass multiple arguments from one function to another

I'm trying to learn python (with my VBA background) buy building a black-jack game as a pedagogical exercise. I've done some searches about passing multiple arguments but I really don't understand what i'm finding in the way of explanations. Looking…
DBWeinstein
  • 8,605
  • 31
  • 73
  • 118
7
votes
1 answer

In Perl, how do I pass a function as argument of another function?

I wrote the following Perl Class: package Menu; use strict; my @MENU_ITEMS; my $HEADER = "Pick one of the options below\n"; my $INPUT_REQUEST = "Type your selection: "; sub new { my $self = {}; $self->{ITEM} = undef; $self->{HEADER} =…
ILikeTacos
  • 17,464
  • 20
  • 58
  • 88
6
votes
4 answers

How to make a method which accepts any number of arguments of any type in Java?

I can see there is a way to have a method in Java which accepts any number of arguments of a specified type: http://www.java-tips.org/java-se-tips/java.lang/how-to-pass-unspecified-number-of-arguments-to-a-m.html but is there a way to make a method…
flea whale
  • 1,783
  • 3
  • 25
  • 38
6
votes
3 answers

Function Decorators

I like being able to measure performance of the python functions I code, so very often I do something similar to this... import time def some_function(arg1, arg2, ..., argN, verbose = True) : t = time.clock() # works best in Windows # t =…
Jaime
  • 65,696
  • 17
  • 124
  • 159
6
votes
1 answer

Groovy named and default arguments

Groovy supports both default, and named arguments. I just dont see them working together. I need some classes to support construction using simple non named arguments, and using named arguments like below: def a1 = new A(2) def a2 = new A(a: 200, b:…
Ayman
  • 11,265
  • 16
  • 66
  • 92