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 of reserved identifiers for the include guard in linenoise.h: The behaviour is undefined. #224

Open
ViralTaco opened this issue Jun 8, 2024 · 0 comments

Comments

@ViralTaco
Copy link

linenoise/linenoise.h

Lines 39 to 40 in d895173

#ifndef __LINENOISE_H
#define __LINENOISE_H

According to the C17 standard (ISO/IEC9899:2017), in §7.1.3 Reserved identifiers:

1
All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use […]
2
If the program […] defines a reserved identifier as a macro name, the behavior is undefined.

This error is so common that it's often overlooked.
Thankfully, the fix is trivial:

#ifndef LINENOISE_H
#define LINENOISE_H

/*...*/

#endif /* LINENOISE_H */
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

1 participant