Questions tagged [arguments]

An argument is a value passed to a function, procedure, or command line program. This also refers to the Array-like `arguments` object in JavaScript.

An argument is a value passed to a function, procedure, or program. It is often used interchangeably with the word "parameter", which also has more specific definitions. Usually "argument", or "actual parameter" (as opposed to "formal parameter") is the value of the parameter used within the called routine.

In other words, parameters are used in procedure definitions, and arguments are used in procedure calls.

arguments can also refer to the Array-like object in JavaScript that is available inside functions, this object can be used to access all of the function's arguments regardless of the function's signature.

11091 questions
4
votes
1 answer

How to create a C++ MFC program that can boot in both GUI Dialog mode or through the command line?

I have a C++ MFC program that works, but I would also like to be able to invoke a simpler version through the command line. (This works by using a cmd line version if there are cmd line arguments.) I would like the program to use the current "cmd"…
4
votes
1 answer

Clojure: function arguments/signatures using macro or def

I have many functions of the same long signature (shortened here for simplicity): (defn f [x & {:keys [a b c d e f g h] :or [a false b false c false d false e false f false g false h false]}] a) I was hoping to use a macro,…
spacingissue
  • 497
  • 2
  • 12
4
votes
2 answers

Variables with no name in constructor's parameter?

I would like to know, when someone gives you a template for a default constructor in C++ and in the parameter there is a series of unnamed variables that somehow are assigned values. What does this mean? Is this legal? How can one access these…
Eamon Bohan
  • 522
  • 2
  • 8
  • 22
4
votes
2 answers

PHP Anonymous Function as Default Argument?

Is there a way to do this in php? //in a class public static function myFunc($x = function($arg) { return 42+$arg; }) { return $x(8); //return 50 if default func is passed in }
Arcymag
  • 1,037
  • 1
  • 8
  • 18
4
votes
5 answers

Get function `arguments` as key-value couples object

In JavaScript one can get the list of arguments passed to a function via arguments, that is an array-like object: >> function fun(a, b, c) { console.log(arguments) }; undefined >> fun(1, 2, 3); [1, 2, 3] Is there a way to obtain an object…
etuardu
  • 5,066
  • 3
  • 46
  • 58
4
votes
3 answers

Adding custom variables to the end of application path when executed in c#

How would I read custom variables end of my application path? I am not sure exactly what they are called, but for example in in the shortcut path of Google Chrome you can add settings to the end of the path such as: "C:\Program Files…
jason
  • 1,132
  • 14
  • 32
4
votes
1 answer

How to override parameter defined in interface method with richer type?

I have these: public class TennisPlayer { } public class RogerFederer : TennisPlayer { } public class RafaelNadal : TennisPlayer { } And then I have some classes with methods, like these: public abstract class Manager { protected abstract…
nawfal
  • 70,104
  • 56
  • 326
  • 368
4
votes
5 answers

Perl passing argument into eval

I'm facing an issue using eval function. Indeed I have some function name inside a SQL database, my goal is to execute those functions within perl (after retrieve in SQL). Here is what I'm doing, considering that $RssSource->{$k}{Proceed} contains…
ehretf
  • 163
  • 10
4
votes
3 answers

How to convert an array of values to parameters in C++

Let's say I have two functions: void a(int arg1) { ... } void b(int arg1, arg2) { ... } And I also have a string with the name of the function I want to call, and an array with all parameters: string func_name = "b"; // 'a' or 'b' int args[] = { 1,…
Alex
  • 34,581
  • 26
  • 91
  • 135
4
votes
4 answers

Why we use non-type template arguments?

I understand the concept but i don't know why i require to use non-type template arguments ?
oiyio
  • 5,219
  • 4
  • 42
  • 54
4
votes
2 answers

Implementing two positional arguments using argparse's `add_subparsers` method

I would like to get the following functionality while using the add_subparsers method of the argparse library and without using the keyword argument nargs: $ python my_program.py scream Hello You just screamed Hello!! $ python my_program.py count…
Bentley4
  • 10,678
  • 25
  • 83
  • 134
4
votes
2 answers

why the code this point to window object?

my code is: var length = 20; function fn(){ console.log(this.length); } var o = { length:10, e:function (fn){ fn(); arguments[0](); } } o.e(fn); the output is 20,1,who can tell me why?
artwl
  • 3,502
  • 6
  • 38
  • 53
4
votes
1 answer

How should I use storage class specifiers like ref, in, out, etc. in function arguments in D?

There are comparatively many storage class specifiers for functions arguments in D, which are: none in (which is equivalent to const scope) out ref scope lazy const immutable shared inout What's the rational behind them? Their names already put…
Ralph Tandetzky
  • 22,780
  • 11
  • 73
  • 120
4
votes
5 answers

javascript: pass arguments to object constructor

i am writing a jquery lib and i need to implement Datetime functions. i need to create a .Date() function which return a new Date object. How to pass arguments of my .Date(args) function to Date object constructor so to create a new date object? i…
demosthenes
  • 1,151
  • 1
  • 13
  • 17
4
votes
3 answers

Remove and add elements to functions argument list in javascript

I have written an observer in javascript. You can trigger Events like this: ClassThatExtendsEvent.triggerEvent('EventName', arg1, arg2, ..., argn) There is a variable number of arguments, with the first argument being the event name. I do as well…
shredding
  • 5,374
  • 3
  • 46
  • 77