Closed shangjiaxuan closed 10 months ago
@shangjiaxuan this would be a change to public API and so needs to be done carefully. The maintainers are conservative about changing public API. It might be best to do an audit of where const
is missing and batch all such changes together. Similar to https://github.com/NIFTI-Imaging/nifti_clib/pull/165
@seanm after searchin through the source code, I believe this is the only function that needs const
added. In fact the corresponding function in nifti1_io.h
and nifti1_io.c
is declared and implemented as const
. The use of opts
is for the fopen("file", "rb")
's "rb" mode parameter, and literal is expected on same code path.
@shangjiaxuan oh, indeed that is weird that it is const in nifti1_io.c but not in nifti2_io.c. I would have expected the opposite.
@hjmjohnson @afni-rickr given the above, I vote for merging this. What do you think?
I do not see a compilation failure for that, so it presumably depends on build options. But this seems like a fine update. Thanks @shangjiaxuan.
The following code currently fails compile because function parameter
opts
is declared as non-const, disallowing literal constants.