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

detects DECL_ASSIGN_LINE on const pointers to functions #472

Open
c-couble opened this issue Dec 23, 2023 · 1 comment
Open

detects DECL_ASSIGN_LINE on const pointers to functions #472

c-couble opened this issue Dec 23, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@c-couble
Copy link

Describe the bug
DECL_ASSIGN_LINE on const variable

Erroneous code
Please use markdown to send the code here.

#include <stddef.h>
#include <stdlib.h>

int     main(void)
{
        void *(*const   f)(size_t) = malloc;
}
main.c: Error!
Error: INVALID_HEADER       (line:   1, col:   1):      Missing or invalid 42 header
Error: DECL_ASSIGN_LINE     (line:   6, col:  32):      Declaration and assignation on a single line

Additional infos

  • OS: Linux
  • python3 --version: Python 3.11.6
  • norminette -v: norminette 3.3.55

Additional context
f is a const variable and it should be possible to declare and assign it on the same line.

@Lilneo786
Copy link

#include <stddef.h>
#include <stdlib.h>

int main(void)
{
    void *(*const f)(size_t) = &malloc; // Assign the address of the malloc function
    return 0;
}

@matthieu42Network matthieu42Network added the bug Something isn't working label Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants