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
2
votes
2 answers

How do you pass multiple variables from functions to main in C?

How do I pass back a local variable from a function to main, if said function already has a return value? Sorry for the question, I'm trying to make it as objective as possible for everyone, not just my case. Specifically: I have a function called…
eveo
  • 2,797
  • 15
  • 61
  • 95
2
votes
2 answers

Error C2228 when constructing boost::function object in constructor argument list

The code below does not compile in Visual C++ 2005. class SomeClass { public: boost::function func; SomeClass(boost::function &func): func(func) { } }; void someFunc() { std::cout << "someFunc" << std::endl; } int…
Eddie
2
votes
3 answers

Handling and passing large group of variables to functions\objects in python

I find myself in a need of working with functions and objects who take a large number of variables. For a specific case, consider a function from a separated module which takes N different variables, which are then pass them on to newly instanced…
Mickey Diamant
  • 657
  • 1
  • 9
  • 17
2
votes
1 answer

Schedule children DynamicActivity loaded from external XAML with parameters

Scenario: I'm implementing a parent activity which executes other activity from external source(database), following this Ron Jacobs post. This approach works but have a few problems in my case, because WorkflowInvoker don't get the parent…
2
votes
7 answers

Memory location of function argument

I'm preparing for my UNIX exam and there is a question about memory location of C variables. Let's say we have code like this char sth; int some_function(int arg) { int some_int; // some code here } so I suppose that sth is located on the…
Jan Vorcak
  • 19,261
  • 14
  • 54
  • 90
2
votes
2 answers

c# inline function arguments and temporary variables

I was wondering about the following situation in C#. Sometimes function names can be quite long, and verbose. I'm using Microsoft's MVC 3 framework for a website at work, Here's an example function: [ImportModelStateFromTempData] [BreadCrumb("New…
Short
  • 7,767
  • 2
  • 25
  • 33
2
votes
1 answer

How to construct dynamic function invocation with variable arguments in Python

I'm attempting to wrap a call to an operation with a variable argument list into a generalized function with fixed arguments like this: def vectorizeIt(args, op) op is a function with a variable number of arguments and args is a list with the…
Rich
  • 12,068
  • 9
  • 62
  • 94
2
votes
4 answers

Is there good argument checking strategy?

instead of checking every input pointer argument with if condition if( in != NULL ), is there better way to do this. One method is to create some macros, like #define CHECK_ARG(x) if(!(x)) { return 0; } In code it's look like this int some_func(…
akmal
  • 655
  • 5
  • 24
2
votes
2 answers

Why does this passed-by-value parameter get corrupted? (c++)

I'm passing a ivec2 (2 dimentional int vector) throw multiple methods calls of differnent classes. All by value. However after the first pass it starts to corrupt. Since the vector implementation if part of the library (called visualisation…
Velrok
  • 345
  • 4
  • 17
2
votes
1 answer

Prolog ECLiPSe - how to implement yield method?

i'm using ECLiPSe programming logic system. i want to implement the yield method for passing the values from prolog to C/C++. Has anyone implemented it? Are there any other ways for passing the values?
Archie
  • 2,564
  • 8
  • 39
  • 50
2
votes
3 answers

Creating a proxy function to fprintf in an unobtrusive way?

I'd like to create a proxy to fprintf, like so: void raise_exception(char *filename, int line, char *format_string, ...) { fprintf(stderr, "Exception in `%s`:%d!\n", filename, line); fprintf(stderr, format_string, ...); …
Albus Dumbledore
  • 12,368
  • 23
  • 64
  • 105
2
votes
3 answers

Instance variable goes out of scope inside method

I have this method which gets called from a different class: -(void)artworkInfo:(NSNumber *)pos{ [image setImage:(UIImage *)[[mainDelegate.mapAnnotations objectAtIndex:(NSUInteger)pos]image]]; [pos release]; } I put debugger stop-points on…
Ryan
  • 570
  • 9
  • 25
2
votes
1 answer

How to use the function "rank" in the function "lapply" in R?

R Version 2.11.1 32-bit on Windows 7 Now I get the code: lapply(x, rank) but I want the "rank" to be: ties.method="first"
PepsiCo
  • 1,399
  • 4
  • 13
  • 18
2
votes
1 answer

How to use GNOME Terminal instead of XTerm here?

I have the following variable defined in ~/.vimrc. This works well with XTerm but I can't get it working with GNOME Terminal. Please help. let g:slimv_client = 'python /home/dumrat/.vim/ftplugin/slimv.py -r "xterm -e sbcl --core…
nakiya
  • 14,063
  • 21
  • 79
  • 118
2
votes
2 answers

Why gets this initializer argument destroyed?

I have an initializer with two arguments: -(id) initWithSourceFrame:(CGRect)sourceViewFrame mappedFrame:(CGRect)mappedViewFrame { CGRect copy = mappedViewFrame; self = [super init]; if (self) { // not able to access mappedViewFrame…