[Development] QtCS 2017 QtCore sessions

Thiago Macieira thiago.macieira at intel.com
Thu Nov 30 20:23:47 CET 2017


On Thursday, 30 November 2017 11:09:01 PST Thiago Macieira wrote:
> API parallelism with the Standard Library is not required where the standard
> library makes mistakes. Requiring constexpr for calculating string lengths
> is one where I think it made a mistake. Therefore, I will not accept that
> as an argument.

>From libstdc++ std::char_traits<wchar_t>

      static _GLIBCXX17_CONSTEXPR size_t
      length(const char_type* __s)
      {
#if __cplusplus > 201402
	if (__constant_string_p(__s))
	  return __gnu_cxx::char_traits<char_type>::length(__s);
	else
#endif
	  return wcslen(__s);
      }

They were added in revision 249137 by Pedro Alves.

The fact that they needed to add that __constant_string_p hack indicates 
there's a design flaw. I'm not saying the change author agrees there's a 
defect, I'm saying change points to a design flaw.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list