Skip to content

Use = {0} initialization instead of explicit memset for stack variables#27251

Merged
sbc100 merged 1 commit into
emscripten-core:mainfrom
sbc100:zero_init
Jul 4, 2026
Merged

Use = {0} initialization instead of explicit memset for stack variables#27251
sbc100 merged 1 commit into
emscripten-core:mainfrom
sbc100:zero_init

Conversation

@sbc100

@sbc100 sbc100 commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Replace explicit memset(..., 0, ...) calls after local array or struct declarations on the stack with direct aggregate zero initialization = {0}. This simplifies the code and allows the compiler to better optimize local variable initialization.

…iables

Replace explicit `memset(..., 0, ...)` calls after local array or struct
declarations on the stack with direct aggregate zero initialization `= {0}`.
This simplifies the code and allows the compiler to better optimize local
variable initialization.
@sbc100 sbc100 changed the title Use = {0} initialization instead of explicit memset for stack var… Use = {0} initialization instead of explicit memset for stack variables Jul 3, 2026
@sbc100 sbc100 requested a review from aheejin July 3, 2026 21:05

@aheejin aheejin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I didn't know this syntax was possible!

@sbc100 sbc100 merged commit 0a97463 into emscripten-core:main Jul 4, 2026
39 checks passed
@sbc100 sbc100 deleted the zero_init branch July 4, 2026 00:20
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.

2 participants