Skip to content

Add comma to final line of C enums - #900

Merged
ShogunPanda merged 1 commit into
nodejs:mainfrom
DimitriPapadopoulos:c_enums_final_comma
Nov 23, 2026
Merged

ShogunPanda merged 1 commit into
nodejs:mainfrom
DimitriPapadopoulos:c_enums_final_comma

Conversation

@DimitriPapadopoulos

@DimitriPapadopoulos DimitriPapadopoulos commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

It is commonplace to have a comma in the last line of enums in C code. This helps minimise diffs when modifying enums.

That's valid for C99 and later only, but I understand C99 is the target:

llhttp/src/common.gypi

Lines 28 to 29 in 85c5d42

# Compile as C++. llhttp.c is actually C99, but C++ is
# close enough in this case.

Besides, the TypeScript code is simpler and straightforward.

@DimitriPapadopoulos DimitriPapadopoulos changed the title Add comma to final line of in C enums Add comma to final line of C enums Nov 22, 2026
It is commonplace to have a comma in the last line of enums in C code.
This helps minimise diffs when modifying enums.

Besides, the TypeScript code is simpler and straightforward.

Signed-off-by: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com>

@Vizonex Vizonex left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DimitriPapadopoulos Your PR Seems reasonable to me, C99 allows trailing commas for enums and most compilers support C99 so I approve this PR. I would've asked for a preview of the code generated but I'm sure this code does the job accurately already.

@ShogunPanda
ShogunPanda merged commit da71850 into nodejs:main Nov 23, 2026
7 checks passed
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

Successfully merging this pull request may close these issues.

3 participants