> On 14 Feb 2018, at 15:28, Christophe Fergeau <cferg...@redhat.com> wrote:
> 
> On Thu, Feb 08, 2018 at 08:16:37AM +0100, Christophe de Dinechin wrote:
>> Using std::string by default is *not* considered a good practice in
>> C++. The reference for C++ good practices are probably best summarized
>> by the C++ Core Guidelines:
>> https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md.
>> Regarding strings, see
>> https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rstr-zstring,
>> which specifically states this:
>> 
>>      Don't convert a C-style string to string unless there is a reason to.
>> 
>> “abc” is a C-style string, even in C++. You should pass it around as const 
>> char *, aka czstring as long as you can. *That* is the C++ good practice 
>> AFAIK.
>> 
> 
> For maximal clarity, the link that you gave says *not* to use const char
> *, but to use czstring instead... This does not say to "pass it around
> as const char *”.

Sorry if I was not maximally clear ;-)

czstring is just a typedef in the GSL for const char *, but the gsl and 
czstring are not (yet) in the standard. Since we don’t use the gsl, for now we 
have no better than const char *.

PS: Personally, I find it a bit confusing that the Core guidelines refer to 
types that are not in the standard ;-D


Christophe



_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to