Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
181 views

Not sure if the following is possible in C++20 after a long and exhaustive search but asking anyway: Using C++20 instead of C's va_list, can I: (1) Encode arbitrary argument lists passed to a variadic ...
pion's user avatar
  • 190
0 votes
1 answer
154 views

I am use TI 8.3.11 (Code Composer Studio) Device Family C6000, SYS/Bios 6.67.3.01 I have a problem with variadic function, which accepts a variable number of arguments. My class: #include "stdint....
user avatar
0 votes
1 answer
94 views

I have a bunch of dynamically allocated arrays (scoped to the entire program): double* Ux{nullptr}; Ux = (double*) fftw_malloc( sizeof(double) * dataSize); which are usually initialized according to: ...
user avatar
1 vote
3 answers
193 views

Spring's UriComponentsBuilder has an empty build() method, as well as variadic build(Object... urivariables). I want to call the second one with an empty array. Is there a better way to do so, then ...
f.khantsis's user avatar
  • 3,610
0 votes
1 answer
38 views

#include <stdio.h> #include <stdarg.h> void open(FILE *file,...){ va_list content; va_start(content, file); vfscanf(file, "%s",content); printf("%s",...
Bishop's user avatar
  • 57
1 vote
2 answers
127 views

I have a class template that take a variadic number of template arguments. The class has some functions that take arguments corresponding to the class's template parameters. I would like these ...
Magnar Myrtveit's user avatar
5 votes
2 answers
326 views

I've created a struct, that groups the format character and a pointer to the function which prints according to the formatter. typedef struct formatter { char spec; void (*print)(va_list); } fmt; ...
Ehab Elsayed's user avatar
1 vote
1 answer
154 views

I have the following function signature: Y = Annotated[TypeVar("Y"), "That which might be yielded"] R = Annotated[TypeVar("R"), "That which might be returned"] ...
JamesTheAwesomeDude's user avatar
0 votes
1 answer
112 views

I have a formatting method that I adapted from this example. I have reduced it to just function calls and a print It works when the formatting string (first argument) is a const char * #include <...
Jean-François Fabre's user avatar
2 votes
3 answers
5k views

Rust is missing Variadic Generics (and also variadic functions) as a language feature. Since it doesn't directly support these, is it possible to emulate the behavior in some way? I suspect this might ...
user2138149's user avatar
  • 18.7k
0 votes
1 answer
98 views

I have a macro that works as expected, but I want to make some changes to make it cleaner to use. #define FuncCreate(func_name, func, ...) \ int func_name(lua_State *ms) { \ func(__VA_ARGS__); ...
Michael's user avatar
  • 133
2 votes
0 answers
224 views

This is a question for the type hinting pros among you. I have the following construct and I'm wondering if there is a way to corrctly add type annotations to it as it is. This is from the Qt ...
maflAT's user avatar
  • 51
0 votes
3 answers
103 views

I have a project in which I am using a third party library. However, I need to call methods from the third party only if the user has copied those jars in the project, or else use the existing jars. ...
Abhishek Ingale's user avatar
-1 votes
1 answer
240 views

I have a logging function which is implemented along the following lines. The basic idea is that I want to give the user printf-like formatting, but to prefix the logged string with a timestamp and ...
fearless_fool's user avatar
1 vote
1 answer
567 views

I have a problem with single/multiple arrays as varargs parameters used in JUnit5 MethodSource's Arguments. If multiple arrays (empty or not) are passed, everything's fine, but if only a single array ...
fozzybear's user avatar
  • 195
0 votes
0 answers
225 views

This post is not just about unresolved linker symbols in general, but about a variadic function in a class with a Q_OBJECT macro. The macro creates a lot of components automatically generated by the ...
CodeLurker's user avatar
  • 1,381
0 votes
1 answer
92 views

I wrote a function similar to the one described in this answer to a SO post about freeing with a variadic function in the C language but for CUDA vectors. Here is the function: void freeCudaVectors(...
Dimitri Lesnoff's user avatar
1 vote
1 answer
407 views

I am wondering if i can create (and call) a function where i can specify the arguments explicitly, like this: myFun(arg1 = 1, arg3 = "test_string") where function = myFun(arg1,arg2,arg3) ...
MIKE PAPADAKIS's user avatar
1 vote
0 answers
170 views

I would like to combine the paste and print functions. This is the best I can do so far: pp <- function(...) { s<-paste0(list(...), sep="") } foo<-"foo" s<-paste0(foo,...
Ray Tayek's user avatar
  • 10k
0 votes
1 answer
116 views

I am looking to create a vector that stores a tuple of the same-index elements from different vectors. Although I am able to achieve it, there's a caveat if the caller passes in vectors of different ...
MKD's user avatar
  • 55
0 votes
1 answer
69 views

I'm sorry in advance for my English, it is not my native speaking language. I'm running this in Python I have a XML-RPC function and, as part of its parameters, there are some filters that you can ...
Luis Espejel's user avatar
0 votes
1 answer
133 views

I'm trying to log some things on my cpp app. I chose to go on variadic parameters. My log functions : inline void log() {} template<class... Args> inline void log(std::string_view first, const ...
Max's user avatar
  • 23
1 vote
1 answer
119 views

I've a function int send_email(const char * to, const char * subject, const char * body, size_t nbr_attachments, ...); it all works fine. I can use it for sending an email with no attachments: ...
iveqy's user avatar
  • 25.5k
1 vote
2 answers
278 views

Why does not Ada support variable function/procedure argument lists? Is it hard to implement or does it somehow go against "we should keep things secure" philosophy of the language? Varargs ...
Student4K's user avatar
  • 960
0 votes
0 answers
87 views

I am a newbie in Scala and am trying to understand partially applied functions. I can implement simple examples like when function takes two integers as input. But I wanted to combine variable number ...
Dhruv's user avatar
  • 597
3 votes
1 answer
245 views

List.of(E e1, E e2, E e3) return ImmutableCollections.ListN(e1, e2, e3); static <E> List<E> of(E e1, E e2, E e3) { return new ImmutableCollections.ListN<>(e1, e2, e3); } and ...
hong-sile's user avatar
0 votes
3 answers
268 views

I have a function that does some arithmetic on two elements like this: template <typename Type> Type add(const Type& a, const Type& b) { // some logic if(!((b >= 0) &&...
lbsmart's user avatar
  • 79
1 vote
2 answers
515 views

(Update: I am programming for microcontrollers, so I am short of memory and computation power. Therefore I am limited to C-strings.) I have a number of strings and want to find the maximum length of ...
Martin_from_K's user avatar
2 votes
2 answers
333 views

I am trying to not only return the output to the stdout but also trying to return the size of each data type that would be tested. I am using the write() syscall to write the simple output to the ...
danisvicex's user avatar
6 votes
0 answers
520 views

If I compile g++ with -Wformat on the following code, I get a warning, as expected. int main(int argc, char * argv[]) { printf("argc %lld\n", argc); } However, if compile the following ...
Jody Hagins's user avatar
  • 28.6k
2 votes
1 answer
187 views

Say I have these two methods: // Overload 1 template <typename T, typename... Args> void Foo(Args&&... args) { // do things with T, args... } // Overload 2 template <typename T, ...
anon's user avatar
  • 560
0 votes
0 answers
76 views

I have the following struct: // fninfo holds a function and its arity. type fninfo struct { arity int // number of arguments that fn takes fn any // fn must take string arguments and return ...
ban_javascript's user avatar
0 votes
1 answer
88 views

I'm creating my own RDBMS to practice C++. I came up with a solution where each column can have a type and is a template. This is what a row looks like, but it doesn't work template <typename... ...
k1t3k's user avatar
  • 3
0 votes
2 answers
156 views

this is my 2nd post and i tried to find as much information before posting here as i could (including the new possibility with chatgpt) to understand some more the work of variadic function. The first ...
mirrowwinger's user avatar
2 votes
1 answer
123 views

We all know there is a collapse argument in paste() function. It refers to an optional character string to separate the results: paste(1:5, collapse = ", ") [1] "1, 2, 3, 4, 5" ...
Leon Smith's user avatar
1 vote
1 answer
297 views

I was learning Java about how varargs works with the generic types. There was this function when I tried to return an array of generic types, which in this case T is String static <T> T[] toArr(...
John Pham's user avatar
0 votes
1 answer
64 views

I am currently tasked with writing a generic thread pool, having multiple worker threads and one scheduling thread in c++. To support running any kind of function within one pool I used variadic ...
adriankroeger's user avatar
3 votes
1 answer
78 views

I am a bit confused about how default argument promotions effect wchar_t. I understand that char is promoted to int, and therefore I have to supply int as the second parameter of va_arg, otherwise I ...
z32a7ul's user avatar
  • 3,847
15 votes
1 answer
805 views

Upon code review/clang-tidy runs, I came across a function with a signature like this: void appendFoo(const char * fmt, va_list& rVaList); I have never seen this before. Afaik, you can pass ...
user3284229's user avatar
2 votes
2 answers
453 views

I run this in MSVC v142. I need to keep multiple va_list and then pass all of them in an array to another API. However, the old va_list were getting overwritten by the newer one. void toVaList(va_list ...
DF24's user avatar
  • 53
3 votes
1 answer
394 views

Trying to grasp Scala 3 type system. Question: Is it possible to write a single universal def curry(f: ???) = ... function that accepts f of any arity and returns a curried fn? No compiler plugins, ...
Max's user avatar
  • 1,917
0 votes
1 answer
17 views

?php $a=" just wait "; echo "Before trimming string length=".strlen($a)."<br>"; echo trim($a)."<br>"; echo "After trimming string length="....
gopal singala's user avatar
0 votes
0 answers
71 views

I was under the impression that I don't need a template in order to use variadics in C++. So in the following class, I have a method that accepts a variadic as its second variable. Now my question is: ...
Injenye Lojik's user avatar
0 votes
1 answer
85 views

As double and unsigned long are the same size, va_arg should pop the equal number of bytes from the stack and the value displayed should be the same every time the program is run since the double ...
Cameleon Two's user avatar
0 votes
1 answer
114 views

I am wondering whether the following is possible in Scala: Given some vector x = (x_1, x_2, ..., x_n) in R^n and a function f that maps R^n to R, I would like to replicate this concept in Scala. The ...
kiyomi's user avatar
  • 131
1 vote
1 answer
134 views

Code to duplicate this on Linux is as follows: GCC 4.8.5 20150623 (Red Hat 4.8.5-44) No i can't change this, it's on CentOS7 and its a requirement to stay there) #include <stdarg.h> struct foo {...
user3696153's user avatar
0 votes
1 answer
103 views

I am working on a helper function using printf format strings, so I started to examine printf format specifications in more detail, and found that GNU's manual allows the use of a param-no: https://...
z32a7ul's user avatar
  • 3,847
0 votes
1 answer
24 views

Noob programmer here, I find myself using the rest parameter often, as a way of keeping my functions adaptable early when I don't know all the variables types/arguments. I would like to develop a ...
hifilo's user avatar
  • 43
0 votes
0 answers
31 views

I'm trying to write a function that intermixes calls to vprintf with usages of the variadic arguments. However, the behavior I am observing does not match my expectation. The following is code that ...
Jeff G's user avatar
  • 4,735
2 votes
1 answer
144 views

package main import ( "fmt" ) type ISum interface { sum() int } type SumImpl struct { Num int } func (s SumImpl) sum() int { return s.Num } func main() { nums := []...
battlecook's user avatar

1 2
3
4 5
55