Questions tagged [variadic]

In computer science, an operator or function is variadic if it can take a varying number of arguments; that is, if its arity is not fixed.

668 questions
-1
votes
1 answer

how to define variadic variable in C

Is there a way to define a variadic size variable in C? For example, I want to define a table where both the entries of the table and size of each entry should vary in accordance to the configuration file without recompiling the source code. To…
-1
votes
1 answer

How to convert a #define in a template (variadic?)

I've two macros and I desire to convert them in C++ templates. I've problems in understendig how to convert them. Here are the two macros: #define __MATRIX_GETVALUE(C,T,val,dim0...) \ va_list vl; \ va_start(vl,dim0); \ …
Sir Jo Black
  • 2,024
  • 2
  • 15
  • 22
-1
votes
2 answers

how to populate va_list

I'm having trouble finding an answer to my "problem". I created a function that takes a varying amount of integers ('findMinVal(int x, ...)') and returns the lowest number in all calls made. right now my program gets the arguments straight through…
Raskanskyz
  • 65
  • 6
-2
votes
1 answer

Call a variadic function in Go

I have code where I am calling filepath.Join as described in the following program. However, I see an error Program: package main import ( "fmt" "path/filepath" ) func main() { myVal := joinPath("dir1", "dir2") …
Alwin Doss
  • 962
  • 2
  • 16
  • 33
-2
votes
1 answer

golang: function with variadic number of interface arguments

I have trouble finding answer to the following question. I have an interface and a struct that implements it. type InterfaceA interface { DoA() } type ImplementsA struct {} func (a ImplementsA) DoA() { fmt.Println("do A") } The question…
-2
votes
1 answer

variadic functions in macro and templates

I try to create a macro that call a variadic function that uses a template. I use the following code, but the linker cannot resolve a call to the macro... This code is part of the Logger class: template< typename ... Args > void…
Kryx
  • 53
  • 12
-3
votes
1 answer

How can i pass []string as ...interface{} argument

I know how to pass it when the arguments are ... strings But this case is a bit different: func main() { args := []string{"hello", "world"} fmt.Println(args...) } https://play.golang.org/p/7ELdQQvdPvR The above code throws the error cannot…
capipo
  • 67
  • 1
  • 6
-3
votes
1 answer

C - Variadic function compiles but gives segmentation fault

I have a variadic function in C to write in a log file, but as soon as it is invoked, it gives a segmentation fault in the header. In the main process, the call has this format: mqbLog("LOG_INFORMATION",0,0,"Connect",0,"","Parameter received"); …
Alan Bry
  • 27
  • 1
  • 7
1 2 3
44
45