Thanks to visit codestin.com
Credit goes to github.com

Skip to content

static const global variable defined in header will bloat binary size #52

@LXYan2333

Description

@LXYan2333

Dear maintainer:

I noticed there are some static const global variable in headers. You can search RegExp static const.*= in headers and find them.

static const uid_t INVALID_UID = (uid_t)-1;

They will bloat binary size when included into multiple translation units. e.g. https://godbolt.org/z/MsYoqTjcx

notice the const static int's ptr is different between two translation units.

Image

I noticed this project targets c++11, which does not support inline variables. Maybe you can use extern const or a macro.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions