function-parameter Questions
3
Solved
Suppose I have a function which takes some pointer parameters - some non-const, through which it may write, and some const through which it only reads. Example:
void f(int * a, int const *b);
Supp...
Quan asked 5/9 at 9:27
5
Solved
Can anyone enlighten me as to why I should bother to specify the size of a C array argument in a function header? For example:
void foo (int iz[6]) { iz[42] = 43; }
With:
int is[2] = {1,2,3};
...
Eschew asked 3/3, 2011 at 22:8
35
Is there a way to get the function parameter names of a function dynamically?
Let’s say my function looks like this:
function doSomething(param1, param2, .... paramN){
// fill an array with the ...
Mixtec asked 17/6, 2009 at 15:57
3
Solved
this is very simple, but I have searched and failed to find a solution for this small problem.
I want to use the argument of a function as the name for a new data frame, for example:
assign.datas...
Distiller asked 27/11, 2017 at 17:46
3
Environment
Visual Studio Code 1.25 for linux (ubuntu 16.04).
Theme VisualStudio Dark.
I'm currently using visual studio code 1.25 in Ubuntu 16.04 for writing c++ code.
I want to change the col...
Terce asked 28/7, 2018 at 20:52
3
Solved
I have this drawer I learned to make on youtube
https://www.youtube.com/watch?v=JLICaBEiJS0&list=PLQkwcJG4YTCSpJ2NLhDTHhi6XBNfk9WiC&index=31
Philipp Lackner
I want to add the drawer to my...
Trip asked 3/12, 2022 at 10:19
3
Solved
Is it valid, according to ISO C (any version), to specify a zero-sized array parameter?
The standard seems ambiguous. While it's clear that zero-sized arrays are invalid, array function parameters ...
Scincoid asked 12/12, 2022 at 23:47
4
Solved
Could you please point me to the nice way of skipping optional parameters in JavaScript.
For example, I want to throw away all opt_ parameters here:
goog.net.XhrIo.send(url, opt_callback, opt_met...
Lasala asked 2/12, 2011 at 12:17
5
Solved
In one of the C++ programs, I saw a function prototype : int Classifier::command(int argc, const char*const* argv)
What does const char*const* argv mean? Is it the same as const char* argv[]?
Does...
Yeryerevan asked 5/4, 2012 at 13:5
15
Solved
I have a function that takes optional arguments as name/value pairs.
function example(varargin)
% Lots of set up stuff
vargs = varargin;
nargs = length(vargs);
names = vargs(1:2:nargs);
values = v...
Gadolinium asked 5/5, 2010 at 17:3
5
Solved
What is the right way to define a function that receives a int->int lambda parameter by reference?
void f(std::function< int(int) >& lambda);
or
void f(auto& lambda);
I'm no...
Besant asked 23/6, 2011 at 18:4
3
Solved
I'm a bit rusty in C++ and I'm switching after a year of python. Naturally I would like to translate the laziness coming from python to C++.
I just discovered rot13 and I'm all excited about it. I...
Krill asked 10/8, 2017 at 12:2
3
Solved
I have a function that looks something like this:
function global:Test-Multi {
Param([string]$Suite)
& perl -S "$Suite\runall.pl" -procs:$env:NUMBER_OF_PROCESSORS
}
I would like to allow t...
Truculent asked 13/11, 2015 at 21:16
2
Solved
I tried constructing pairs of integers where the second integer is greater than the first by 1:
1 2
2 3
3 4
Using both std::make_pair and the constructor like so:
std::make_pair(n, n++);
Howe...
Openwork asked 2/5, 2020 at 22:6
3
Solved
There is a situation where I want to collect all the nodes names of a path to one key in JSON. Consider the condition: JSON array index "0", "1" are also allowed, but it is easy...
Teaser asked 16/4, 2020 at 5:19
2
Solved
Here is a function declaration with default arguments:
void func(int a = 1,int b = 1,...,int x = 1)
How can avoid calling func(1,1,...,2)
when I only want to set the x parameter and for th...
Obliquity asked 8/8, 2018 at 10:11
3
Solved
According to 5.2.2/4 "Function call" in n4640 (8.2.2/4 in n4659) function parameters are created and destroyed in the context of the caller. And implementations are allowed to delay the destruction...
Hardison asked 26/1, 2018 at 0:2
2
Solved
Basically something like this:
DEFAULT_TIMEOUT = 10
# or even: from my_settings import DEFAULT_TIMEOUT
def get_google(timeout=DEFAULT_TIMEOUT):
return requests.get('google.com', timeout=timeout)...
Pensionary asked 30/12, 2017 at 1:25
10
Solved
I've noticed that a common pattern I use is to assign SomeClass.__init__() arguments to self attributes of the same name. Example:
class SomeClass():
def __init__(self, a, b, c):
self.a = a
sel...
Scratchy asked 30/12, 2011 at 18:47
3
Solved
Consider this code snippet:
void foo(int a[], int b[]){
static_assert(sizeof(a) == sizeof(int*));
static_assert(sizeof(b) == sizeof(int*));
b = a;
printf("%d", b[1]);
assert(a == b); // This ...
Subotica asked 24/11, 2017 at 7:21
2
Solved
While I was browsing cppreference, I saw a strange type array in function parameters like this:
void f(double x[volatile], const double y[volatile]);
So, What is the purpose of the volatile keyw...
Supercolumnar asked 19/11, 2017 at 12:57
1
Solved
Using numba.jit in python.
I can convert normal functions to jit-type and run:
from numba import jit
def sum(a, b):
return a+b
func = jit(sum)
print(func(1, 2))
How to do this to methods? So...
Graniela asked 18/10, 2017 at 10:45
3
Solved
Function prototype
void foo(int n, int a[][]);
gives error about incomplete type while
void foo(int n, int (*a)[]);
compiles. As per the decay rule int a[][] is equivalent to int (*a)[] in...
Depreciate asked 20/6, 2017 at 14:28
3
Solved
I know what the meaning of an asterisk is in a function definition in Python.
I often, though, see asterisks for calls to functions with parameters like:
def foo(*args, **kwargs):
first_func(arg...
Gamin asked 3/7, 2015 at 2:37
4
Solved
Consider, for example:
int sum(int a, int b)
{
return a + b;
}
vs.
int sum(const int a, const int b)
{
return a + b;
}
Is the second approach in general faster?
Function parameters in C ar...
Rheingold asked 6/9, 2012 at 0:51
1 Next >
© 2022 - 2024 — McMap. All rights reserved.