DigiNews

Tech Watch by Johan Denoyer

← Back to articles

The C++20’s u8/char8_t Backward-Compatibility Fiasco

Quality: 7/10 Relevance: 9/10

Summary

The article explains that C++20's u8 and char8_t introduce a backward-compatibility issue: code that compiles under C++17 may fail under C++20 due to a change in how u8 literals are interpreted. It uses a concrete example showing a function expecting a char* while the same code becomes incompatible because u8 literals become char8_t arrays, illustrated by a MSVC error and accompanying visuals. The post discusses mitigation strategies, including avoiding the u8 prefix and citing Google's style guide, to ease upgrading large codebases.

🚀 Service construit par Johan Denoyer