-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add const version of some array operation #37
Comments
This would probably also remove some explicit casts from |
I am wary of adding even more "overloads" of existing functions, especially when the only purpose is purely to avoid some benign explicit casts... The way I see it, explicit-casting nested const pointers is a necessity that stems from a shortcoming of the C language - you'll notice that C++ does not have this limitation: https://stackoverflow.com/questions/5055655/double-pointer-const-correctness-warnings-in-c I'm not exactly "against" the idea of this issue, but I simply feel that it is the kind of thing that will be better fixed when libccc is eventually ported to ++C - that way I won't have to change my code to be uglier and more unwieldy. |
okay, I trust you with how you want to use ++c to solve that. I agree it does make the code a bit more heavier to change... I'm curious about how you can solve that with ++c. Some kind of function overloading or more advanced macros/templating system? |
Some array/strings utility function cannot take a
T const**
as argument because they need to possibly reallocate and return the new pointer to the array.For example:
This forces
T const**
type array to be casted toT**
.One should be able to pass a
T const**
type array because the function does not modify the elements.I suggest adding another version of these functions and wrapping them like so:
Here is a list of all the functions I think this applies:
t_char const*
, does that make sense?)The text was updated successfully, but these errors were encountered: