[cfe-dev] Setting default dialect to C++11

Richard Smith via cfe-dev cfe-dev at lists.llvm.org
Mon Mar 6 15:57:12 PST 2017


On 6 March 2017 at 06:37, Hal Finkel via cfe-dev <cfe-dev at lists.llvm.org>
wrote:

> On 03/06/2017 04:22 AM, Piotr Padlewski via cfe-dev wrote:
>
> I belive that users will expect to compile C++11 code on default because
> of GCC. I think moving to C++14 (with the Richard's policy from June) is a
> good choice, because of user experiance of developers (specially new). Is
> there a list of things that might break after switching to C++11? I wonder
> how much bugs could be found easily by clang-tidy (or to implement it as
> clang warning), so that prior to switch users would know what would break.
>
>
> There is a pretty good list in Appendix C of the C++ standard. Also, see:
>
>   http://stackoverflow.com/questions/6399615/what-breaking-changes-are-
> introduced-in-c11
>
> which summarizes most of those and covers some others.
>

The two largest issues (by *far*) we encountered when porting our codebase
from C++98 to C++11 were:

1) narrowing conversions in list initialization; char buf[] = { 'f', 'o',
'o', '0' + n, 0 }; is now ill-formed
2) UDLs versus macros; printf("%10"PRIuS, my_size_t); and "in "__FILE__":"
are now ill-formed

Clang provides warning flags to disable the error for the first case
(-Wno-c++11-narrowing) and for the first half of the second case
(-Wno-reserved-user-defined-literal).

Compared to the above, silent changes in behavior were extremely rare.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170306/9fea9f06/attachment.html>


More information about the cfe-dev mailing list