C's void func() vs. void func(void).

ciechowoj via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jul 29 03:57:37 PDT 2016


In C, a function `void func()` doesn't declare a function without 
arguments, instead it declares a function that takes unspecified 
number of arguments. The correct way to declare a function that 
takes no arguments is to use the `void` keyword: `void 
func(void)`.

What is the correct way to refer to such a function (`void 
func()`) from D bindings?

If I assume that the unspecified number of arguments (for some 
particular function) is equal to zero, is `extern (C) void 
func()` a correct D binding to the both functions `void func()` 
and `void func(void)` declared in C?

Specifically, I'm concerned about calling convention issues.


More information about the Digitalmars-d-learn mailing list