Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/remove qos designated initializers #354

Conversation

DenisBiryukov91
Copy link
Contributor

move qos-related functions from header into .c to hide usage of designated initializers from c++ (closes #352)

Copy link
Contributor

@milyin milyin left a comment

Choose a reason for hiding this comment

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

I think it's better to make the fix in the header, without moving implementation to C, like here e76e367
Moving code to C may affect the performance (additional call instead of inlining)

_Bool nodrop = congestion_control == Z_CONGESTION_CONTROL_DROP ? 0 : 1;
_z_n_qos_t ret = {._val = (uint8_t)((express << 4) | (nodrop << 3) | priority)};
ret._val = (uint8_t)((express << 4) | (nodrop << 3) | priority);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer the form

_z_n_qos_t ret = { uint8_t)((express << 4) | (nodrop << 3) | priority };

This would guarantee that all fields in _z_n_qos_t are set.
Though this variant works too.

@milyin milyin merged commit a657a1d into eclipse-zenoh:main Feb 26, 2024
48 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.

remove C++17 incompatible designated initializers from headers [Bug]
2 participants