issues
search
ned14
/
status-code
Proposed SG14 status_code for the C++ standard
Other
66
stars
13
forks
source link
status_code_domain::string_ref and atomic_refcounted_string_ref have a bad API around zero termination
#39
Open
ned14
opened
3 years ago
ned14
commented
3 years ago
The caller is expected to
malloc
a region
length + 1
and zero terminate it before handing it in.
This is highly prone to mistake and surprise.
The API should be refactored around what
path_view
does i.e. caller must specify zero termination.
I also think caller should not be calling
malloc
in the first place, that's an internal implementation detail which should not be exposed.
Also what about on Freestanding where there is no
malloc
?
malloc
a regionlength + 1
and zero terminate it before handing it in.path_view
does i.e. caller must specify zero termination.malloc
in the first place, that's an internal implementation detail which should not be exposed.malloc
?