Skip to content

Commit

Permalink
Merge pull request #759 from myk002/myk_init_union
Browse files Browse the repository at this point in the history
zero-init otherwise uninitialized unions
  • Loading branch information
myk002 authored May 20, 2024
2 parents 4192a6e + d587964 commit 58a9b9e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion StructFields.pm
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ sub emit_struct_fields($$;%) {
} 'fields-' . $fields_group;

# Needed for unions with fields with non-default ctors (e.g. bitfields)
emit "$name(){}";
emit "$name(){memset(this, 0, sizeof($name));}";

return;
}
Expand Down

0 comments on commit 58a9b9e

Please sign in to comment.