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

Drop special treatment of functions with the empty parameter list #556

Open
ForNeVeR opened this issue Mar 16, 2024 · 2 comments
Open

Drop special treatment of functions with the empty parameter list #556

ForNeVeR opened this issue Mar 16, 2024 · 2 comments
Labels
area:compiler Related to code compilation or type checking area:standard-support Related to the C standard support kind:feature New feature or request status:help-wanted Open for contributors

Comments

@ForNeVeR
Copy link
Owner

ForNeVeR commented Mar 16, 2024

C23 has dropped the requirement of special treatment for the functions with empty parameter list, such as:

void foo();

In previous versions of the standard, this would introduce a function declaration with a lax parameter list, meaning the caller can call it while passing any parameters.

In C23, this is no longer the case, and declarations such as void foo(); and void foo(void); are strictly identical: they declare a function with no parameters.

For a summary of changes, see Annex M, M.2 Fifth Edition:

Major changes in this fifth edition (__STDC_VERSION__ 202311L) include:

  • mandated function declarations whose parameter list is empty be treated the same as a parameter list which only contain a single void;

See also proposal N2841 that's been accepted.

This unfortunate behavior has been causing a fair amount of pain for implementing the previous standard versions in Cesium, so I am glad we could finally drop it.

@ForNeVeR ForNeVeR added kind:feature New feature or request status:help-wanted Open for contributors area:standard-support Related to the C standard support area:compiler Related to code compilation or type checking labels Mar 16, 2024
@kant2002
Copy link
Contributor

I would say we need a switch to support old scenario.

@ForNeVeR
Copy link
Owner Author

I'd say it already costs us a lot of resources in proper support.

Maybe we can implement some easy workaround instead, like ignoring the argument lists for these functions completely (with a switch).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:compiler Related to code compilation or type checking area:standard-support Related to the C standard support kind:feature New feature or request status:help-wanted Open for contributors
Projects
None yet
Development

No branches or pull requests

2 participants