#14154 closed bug (fixed)

App server: Replace abs(unsigned) with conditional operator

Reported by: mt Owned by: axeld
Priority: normal Milestone: Unscheduled
Component: Servers/app_server Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

https://review.haiku-os.org/#/c/haiku/+/210/

Replace abs(unsigned) and abs(uint32) with conditional operator, since call of overloaded 'abs(uint)' is ambiguous.

/home/haiku/haiku/haiku/src/servers/app/Screen.cpp: In member function 'int32 Screen::_FindBestMode(const display_mode*, uint32, uint16, uint16, uint32, float) const':
/home/haiku/haiku/haiku/src/servers/app/Screen.cpp:268:39: error: call of overloaded 'abs(unsigned int)' is ambiguous
    + 100 * abs(mode.space - colorSpace);
                                       ^
/home/haiku/haiku/haiku/src/servers/app/drawing/interface/local/AccelerantHWInterface.cpp: In member function 'status_t AccelerantHWInterface::_FindBestMode(const display_mode&, float, display_mode&, int32*) const':
/home/haiku/haiku/haiku/src/servers/app/drawing/interface/local/AccelerantHWInterface.cpp:504:66: error: call of overloaded 'abs(uint32)' is ambiguous
    + abs(mode.timing.pixel_clock - compareMode.timing.pixel_clock)
                                                                  ^
/home/haiku/haiku/haiku/src/servers/app/drawing/interface/local/AccelerantHWInterface.cpp:507:46: error: call of overloaded 'abs(uint32)' is ambiguous
    + 100 * abs(mode.space - compareMode.space);
                                              ^

Change History (3)

comment:1 Changed 11 months ago by korli

How do you become this error?

comment:2 Changed 11 months ago by mt

Hi, gcc8 point outs this error.

It seems this feature was implemented from gcc6. https://gcc.gnu.org/gcc-6/porting_to.html

comment:3 Changed 11 months ago by waddlesplash

Resolution: fixed
Status: newclosed

Merged. Thanks!

Note: See TracTickets for help on using tickets.