On Sep 25, 2011, at 3:35 AM, Sebastian Redl wrote: > > On 24.09.2011, at 01:30, [email protected] wrote: > >> [dcl.init.list] dictates errors for narrowing conversions, which triggers >> even for trivial AltiVec literals such as those inside <altivec.h>. >> >> Attached is a big hammer written by a manager. > > I probably invalidated this patch with my recent commits. > > In any case, though, I don't think this is the right approach. First, C++11 > specifies that narrowing conversions are errors in list-initialization, > unless the source is a compile-time known value which fits into the target > type. I don't see why an exception should be made for AltiVec literals. > Second, if <altivec.h> triggers the error with literals, doesn't that mean > the header is actually buggy? Third, there may be more places where this > C++11 behavior may trigger errors in 3rd party headers, so I think the right > approach is to disable the error in system headers, not for AltiVec literals.
AltiVec literals were defined using both paren and braces syntaxes long before Bjarne and Gaby wrote N1919, which appears to be the first place they decided to propose banning narrowing. The historical perspective presented there is pretty clear on the reasons they decided to ban narrowing. The paren syntax used for AltiVec literals wasn't in C/C++ at all at the time it was defined. The brace syntax appeared solely because the GCC community didn't like the paren syntax and elected to make up their own approach. In both cases, those legacy syntaxes now happen to match C++11 features (and OpenCL, etc.). While we can certainly address the issues in <altivec.h> via several means, I'm concerned that lots of other valid AltiVec code outside that header will want to otherwise move forward to C++11 and won't want to introduce casts everywhere (16 per literal!). I fully accept that this may not be the right way/place to fix this, but I'm pretty sure that I don't accept that AltiVec literals should be retoactively absorbed into C++11 syntax like this. ----------------------------------------- Alex Rosenberg Manager, Platform Architecture Sony Computer Entertainment America, Inc. _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
