[wwwdocs] New bits to porting_to

Jonathan Wakely jwakely@redhat.com
Sun Feb 14 17:39:00 GMT 2016


On 14/02/16 14:14 +0100, Gerald Pfeifer wrote:
>Hi Marek,
>
>On Wed, 10 Feb 2016, Marek Polacek wrote:
>> +The additional overloads can cause the compiler to reject invalid code that
>> +was accepted before.  An example of such code is the below:
>
>which additional overloads does this refer to?

The clue is in the title of that section:

  Call of overloaded 'abs(unsigned int&)' is ambiguous

That's a subsection of "Header <stdlib.h> changes" which says "The C++
header defines additional overloads of some functions", which refers
to 'abs' (in fact that's the only extra overload C++ adds to
<stdlib.h>, unlike <math.h> which has loads added).

It could be changed to "defines additional overloads of
<code>abs</code>" if that helps.

>> +Since calling <code>abs()</code> on an unsigned value doesn't make sense,
>> +this code will become explicitly invalid as per discussion in the LWG.
>
>How is this related to overloads?  I feel there is some tacit
>knowledge involved, which I and presuambly many of our users
>may be lacking?

The error you get for that code is the title of the section, and is
because there are overloads of 'abs' for signed types but no overload
that matches an unsigned type.



More information about the Gcc-patches mailing list