bugAVR C Runtime Library - Bugs: bug #57114, Do not #define abs / labs


You are not allowed to post comments on this tracker with your current authentication level.

bug #57114: Do not #define abs / labs

Submitter:  Georg-Johann Lay <gjlayde>
Submitted:  Fri 25 Oct 2019 08:42:00 AM UTC
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  None Assigned to:  None
Percent Complete:  0% Open/Closed:  Open
Release:  2.0.0 Fixed Release:  None

Fri 25 Oct 2019 08:42:00 AM UTC, original submission:  

#define'ing abs is evil, in particular together with C++ when there are methods called abs or there is abs polymorphism.

Same for labs.

The patch provides proper functions (kind of) without introducing overhead.

        * include/stdlib.h (__ATTR_ALWAYS_INLINE__): New macro.
        (abs): Provide in such a way that we get a prototype.
        (labs): Same.

Georg-Johann Lay <gjlayde>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #47738:  stdlib-abs.diff added by gjlayde (1KiB - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by gjlayde (Submitted the item)

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-10-25 gjlayde Attached File- Added stdlib-abs.diff, #47738

    Back to the top

    Powered by Savane 3.13-4e86.
    Corresponding source code