SDL_ttf
SDL_ttf copied to clipboard
Deprecate support of null terminated strings
All the functions in for example TTF_Render* are all null terminated strings. This is bad practice for several reasons, one is security, but another one is that in C++ I would like to map the functions with string_views which are not null terminated in any shape or form. Solution is to provide a character length parameter to all the functions.
I don't think we want an ABI breaking change simply for handling non null terminated strings ..moreover, all SDL interfaces are C, which make them more compatible.
I don't think we want an ABI breaking change
Deprecation is not breaking.
simply for handling non null terminated strings
"simply"? I have already explained why they are a bad idea.
..moreover, all SDL interfaces are C, which make them more compatible.
Huh? Adding length parameters and deprecating null terminated strings does not make the library any less C or any less compatible. In fact i would say most languages dont natively have null terminated strings but have extra functions to cater to "C compatability"( basic_string<T>::c_str()
) as you call it. So in fact the opposite is true.
I think it would be a good idea to add functions that take string and length, all other languages besides C that use bindings to SDL have string types with length, and it's even considered unsafe to use nul-terminated strings in C.