Skip to content

Turn some assert() to static_assert() - #2492

Open
kinkie wants to merge 1 commit into
squid-cache:masterfrom
kinkie:assert-to-static_assert
Open

Turn some assert() to static_assert()#2492
kinkie wants to merge 1 commit into
squid-cache:masterfrom
kinkie:assert-to-static_assert

Conversation

@kinkie

@kinkie kinkie commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Some assert(3) calls in Squid's codebase can be turned to
static_assert(). Do so

@kinkie kinkie added the backport-to-v7 maintainer has approved these changes for v7 backporting label Sep 12, 2026

@yadij yadij 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.

Thank you for this. Just one nit.

Comment thread src/htcp.cc
htcpAuthHeader auth;
size_t copy_sz = 0;
assert(2 == sizeof(uint16_t));
static_assert(2 == sizeof(uint16_t));

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.

Suggested change
static_assert(2 == sizeof(uint16_t));
static_assert(sizeof(uint16_t) == 2);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-v7 maintainer has approved these changes for v7 backporting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants