-
Notifications
You must be signed in to change notification settings - Fork 267
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
const qualifiers in pubic API #845
Comments
I agree with your point. It would probably be best if function arguments that are pointers (or arrays) to variables that aren't allowed to be changed by the function were marked as However, are you sure that |
I believe you can do UPDATE: actually, after looking at https://en.cppreference.com/w/c/language/array I think |
This will take me quite a while to resolve, since I would need to revise all APIs to essentially all my packages. It might also require an SO change to all my packages as well. But I'll consider it for the future. |
Cppcheck detects pointer that are not modified and proposes a modification of the function signature. Tim, tell me one library to begin with and I will create an according merge request. From the changes you will have a good starting point what to revise. Are you interested? |
No. It would be too disruptive to existing applications that use my codes,
if I were to change the user visible api.
Sent from Gmail Mobile
…On Mon, Oct 28, 2024 at 5:34 PM Christoph Grüninger < ***@***.***> wrote:
Cppcheck detects pointer that are not modified and proposes a modification
of the function signature. Tim, tell me one library to begin with and I
will create an according merge request. From the changes you will have a
good starting point what to revise. Are you interested?
—
Reply to this email directly, view it on GitHub
<#845 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEYIION27OKNTUTAXCDFAV3Z52UWJAVCNFSM6AAAAABKAIHCNSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBSHAYDAMBXGE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Tim, I see you concerns. What about a less disruptive approach using a toggle?
By the way, at SuperLU we have a similar discussion and currently no solution. The claim is that when the interfaces introduces |
Got it. That would be much less disruptive. Would the API changes be limited to just adding the const? |
Is your feature request related to a problem? Please describe.
I'm writing a rust sys crate that uses bindgen to automatically generate rust bindings for suitesparse. At the moment when wrapping a function like
klu_analyze
in the KLU solver, raw pointers are wrapped as mutable pointers*mut T
, e.g: the C functionbecomes
This is an issue because the arguments
Ap
andAi
are incorrectly marked as mutable, causing problems downstream for users who are then required to have mutable handles toAp
andAi
. This can be corrected by marking the argumentsAp
andAi
in the C signature asconst
, for example:which would then generate the correct rust function signature with
Ap
andAi
marked as `const.Are there any plans to explicitly use
const
qualifiers in suitesparse rather than relying on comments like this? Would you be happy if I put together a PR adding this to the functions that I need?Describe the solution you'd like
Use explicit
const
qualifiers in public facing functions.Describe alternatives you've considered
The alternative is for the bindings for suitesparse be manually implemented, rather than relying on automated tools.
The text was updated successfully, but these errors were encountered: