Plan9 C doesn't like void functions with no parameters, how do you satisfy the params not checked error?

@neauoire A function taking no parameters needs to be explicitly declared as such by giving it the void type parameter.

void fn(void);

@kvik I had no idea until today. I'll be more careful. I have a ton of something(), I don't remember tcc ever complaining, so I never knew.

@neauoire @kvik the lack of

void foo(void);
void foo(void) {}

Is a C-ism that was removed in C++ and iirc it’s a holdover from old C dialects like what you’d see in/pre unix v8 where arguments look like

double
fabs(arg)
double arg;
{...}

it’s a way of explicitly communicating to the compiler that /no args are passed/ since in many/some older compilers it’s okay it /no args are used/ or smth like that

Follow

@henesy @neauoire If I'm reading the standard right, (open-std.org/jtc1/sc22/wg14/ww section 6.7.6.3. points 10 and 14) a declaration with an empty parameter type list should mean the same as void fn(...); which means unknown number and types of arguments. Presumably you then could use va_arg facility in its definition.

In any case void fn() and void fn(void) are of different types.

@henesy @neauoire Using void fn() instead of void fn(...) is allowed but discouraged in ANSI C, while the Plan 9 compilers reject it outright.

Sign in to participate in the conversation
Mastodon @ SDF

"I appreciate SDF but it's a general-purpose server and the name doesn't make it obvious that it's about art." - Eugen Rochko