Skip to content

policies/coding-style.md: move "defined" to other function-like things #114

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

esyr
Copy link

@esyr esyr commented Aug 11, 2025

While "defined" is indeed a unary preprocessor operator, it is treated as a function sintactically in the codebase, similar to sizeof and friends.

@levitte
Copy link
Member

levitte commented Aug 11, 2025

I think it should be mentioned that defined is a preprocessor operator and not a C keyword, for clarity

@esyr
Copy link
Author

esyr commented Aug 12, 2025

Not sure how to do it, the whole paragraph avoids mentioning the kind of the entities it discusses (and alignof and __attribute__ are not keywords anyway), what would you suggest?

@levitte
Copy link
Member

levitte commented Aug 12, 2025

Hmmm, I've understood alignof and __attribute__ as nonstandard C language keywords, just like sizeof. https://cppreference.com/w/c/keyword.html does at least refer to alignof as a keyword in C23.

defined is solely a preprocessor keyword, i.e. it's not at all defined in the C language proper.

I'll try to propose something.

While "defined" is indeed a unary preprocessor operator, it is treated
as a function sintactically in the codebase, similar to sizeof
and friends.

Co-Authored-by: Richard Levitte <[email protected]>
Signed-off-by: Eugene Syromiatnikov <[email protected]>
@levitte levitte added the minor edit The policy change is a minor edit not requiring vote label Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor edit The policy change is a minor edit not requiring vote
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants