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

draft: avoid undefined behaviour in C macro #8

Merged
merged 1 commit into from
Jun 26, 2024

Conversation

gulafaran
Copy link
Contributor

to safely use wl_container_of with a class the class has to be no virtual functions, no inheritance, and uniform access control (e.g all public)

work around this by putting this into a destroywrapper struct.

fixes #7

il mark this as a draft until this has been properly reviewed, i struggled hard with std::format so its somewhat a proof of concept, clang is happy and locally it seems to run fine.

Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

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

rest lgtm

src/main.cpp Outdated Show resolved Hide resolved
to safely use wl_container_of with a class the class has to be no
virtual functions, no inheritance, and uniform access control (e.g all
public)

work around this by putting this into a destroywrapper struct.
Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

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

thanks!

@vaxerski vaxerski merged commit c1e34fb into hyprwm:main Jun 26, 2024
1 check 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.

undefined behaviour with wl_container_of
2 participants