Closed atyshka closed 3 years ago
PIC and C Producer are pure C-99.
@MushMal I don't understand, C99 fully supports const chars
I'd be willing to help implement this if you approve the api change, otherwise I guess I'll just maintain a separate fork
The entire codebase is pure c which does not have constant. You can either cast in your c++ codebase or fork
Is your feature request related to a problem? Please describe. I'm building a C++ application on top of this C code and I've noticed that a lot of the API for this library uses char for string parameters rather than const char. When the function doesn't need to mutate the result it makes sense that such parameters should be constant. One issue with this is that passing in string literals as char rather than const char will work correctly but trigger compiler warnings as that's technically forbidden by the standard. Additionally, in my case, when using C++ std library it's easy to convert a std::string to a const char but clumsy to make a char.
Describe the solution you'd like I would like if the API would be modified to use const strings when such strings will not be modified. This would be more in line with standard conventions for C libraries and improve user experience.