Unable to call variadic function with no named parameters even though it is useful since C23 #123773
Closed
Description
You have always been able to define variadic functions in C with no named parameters, but until C23 it was not useful because you could never access those arguments
Since C23 the va_start
macro in C has been changed to no longer require a parameter name, so now being able to call variadic functions with no named parameters is actually useful
extern "C" {
fn foo(...);
}
I would expect this to compile, if there was a function foo
defined in C like so
void foo(...) { // the ... is optional pre-c23, but since C23 its required to make the function variadic
// whatever implementation
}
But instead this does not compile
error: C-variadic function must be declared with at least one named argument
--> src\lib.rs:2:12
|
2 | fn foo(...);
| ^^^
Meta
rustc --version --verbose
:
binary: rustc
commit-hash: 07dca489ac2d933c78d3c5158e3f43beefeb02ce
commit-date: 2024-02-04
host: x86_64-pc-windows-msvc
release: 1.76.0
LLVM version: 17.0.6
Activity