I'm using some C Leagacy Code within a C++ project.
On used C function looks like this
void Add_To_log(const * const char pString_1, const * const char pString_2, int number);
Now when I call this Functions from C++ Code like this
foo()
{
Add_To_log("my first string", "my second string", 2);
}
I get a compiler warning ISO C++ Forbids converting string to char. So to get rid of this i thought of creating a c++ wrapper with string_view to avoid unnecessary coping of my strings
void CPP_Wrapper(const string_view& string1, const string_view& string2, int number)
{
Add_To_log(string1, string2, 2);
}
Now if i understood the reference correctly string_view does not necessarily contain a terminating null character with is essential for all c functions because it does not own the string object. It simply displays it.
However can i assume in my particular case that string1 and string2 are null terminated?