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

Use const pointers in APIs where appropriate #14

Open
newling opened this issue Dec 9, 2024 · 0 comments
Open

Use const pointers in APIs where appropriate #14

newling opened this issue Dec 9, 2024 · 0 comments

Comments

@newling
Copy link

newling commented Dec 9, 2024

In an iree project we are using functions like XAie_DmaGetMaxQueueSize in a C++ class for modeling AIE devices. The class stores a XAie_DevInst * as a class member which is used in class getter 'methods' to, for example, get the maximum queue size. The should ideally be const member functions.

As the functions in xaie_dma.h do not ever take const pointers as arguments, we have a problem: we either have to make our class getters non-const, or use a C++ const_cast under the hood before calling the aie-rt API. We don't like either of these options -- the first means we have to pass the model class by non-const reference even though it is never mutated, and the second means that we implicitly rely on aie_rt not to change the value pointed to.

So request: use const correctness where possible. I'll make a PR demonstrating this soon

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

No branches or pull requests

1 participant