Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use void for empty argument lists in C #6

Closed
szhorvat opened this issue Feb 6, 2024 · 5 comments
Closed

Use void for empty argument lists in C #6

szhorvat opened this issue Feb 6, 2024 · 5 comments

Comments

@szhorvat
Copy link
Member

szhorvat commented Feb 6, 2024

void f() is not a valid function prototype in C for empty argument lists. Stimulus should generate void f(void) in these cases. This is important for R to avoid warnings that CRAN cares about.

@ntamas
Copy link
Member

ntamas commented Feb 6, 2024

Should be fixed now (see last two commits).

@ntamas ntamas closed this as completed Feb 6, 2024
@szhorvat
Copy link
Member Author

szhorvat commented Feb 6, 2024

Hm, this still seems to generate R_igraph_version() instead of R_igraph_version(void).

But fixing this is not urgent since the affected functions aren't actually used at this moment. Just enjoy your trip :-)

@ntamas
Copy link
Member

ntamas commented Feb 6, 2024

Which file is that? I've found SEXP R_igraph_version() { in src/rinterface.c but here it is valid to omit void, right?

@szhorvat
Copy link
Member Author

szhorvat commented Feb 6, 2024

but here it is valid to omit void, right?

No, it is not, as there was no other prototype, and with () the argument list is left unspecified. It should be (void).

In C++, foo() means no arguments. In C, foo() means no information provided about the arguments. Not providing any argument info is "deprecated", according to the compiler.

warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
int foo() { return 1; }
       ^
        void

@ntamas
Copy link
Member

ntamas commented Feb 6, 2024

Okay, this should now be fixed in 0.21.4.

@szhorvat szhorvat changed the title Use void for empty arhument lists in C Use void for empty argument lists in C Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants