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

2016-07-29 Thread Mike Parker via Digitalmars-d-learn
On Friday, 29 July 2016 at 18:24:52 UTC, ag0aep6g wrote: On 07/29/2016 02:15 PM, Mike Parker wrote: And if it is a cross-platform library that is stdcall on Windows and cdecl elsewhere: extern(C) void fun(); extern(System), no? Yeah, that's what I had intended.

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

2016-07-29 Thread ag0aep6g via Digitalmars-d-learn
On 07/29/2016 02:15 PM, Mike Parker wrote: And if it is a cross-platform library that is stdcall on Windows and cdecl elsewhere: extern(C) void fun(); extern(System), no?

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

2016-07-29 Thread ciechowoj via Digitalmars-d-learn
On Friday, 29 July 2016 at 12:20:17 UTC, Mike Parker wrote: Though, I should add the caveat that you need to ensure the definition of the C function does not specify any parameters. AFAIK, this is legal: // foo.h void func(); // foo.c void func(int a, int b) { ... } In which case you would

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

2016-07-29 Thread Mike Parker via Digitalmars-d-learn
On Friday, 29 July 2016 at 12:15:22 UTC, Mike Parker wrote: Yes, this is correct as long as the calling convention is not stdcall or something else: Though, I should add the caveat that you need to ensure the definition of the C function does not specify any parameters. AFAIK, this is lega

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

2016-07-29 Thread Mike Parker via Digitalmars-d-learn
On Friday, 29 July 2016 at 10:57:37 UTC, ciechowoj wrote: 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` ke

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

2016-07-29 Thread ciechowoj via Digitalmars-d-learn
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 ref