avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #57114] Do not #define abs / labs


From: Georg-Johann Lay
Subject: [bug #57114] Do not #define abs / labs
Date: Fri, 25 Oct 2019 04:42:02 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0

URL:
  <https://savannah.nongnu.org/bugs/?57114>

                 Summary: Do not #define abs / labs
                 Project: AVR C Runtime Library
            Submitted by: gjlayde
            Submitted on: Fri 25 Oct 2019 08:42:00 AM UTC
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
        Percent Complete: 0%
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 2.0.0
           Fixed Release: None

    _______________________________________________________

Details:

#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.




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 25 Oct 2019 08:42:00 AM UTC  Name: stdlib-abs.diff  Size: 1KiB   By:
gjlayde

<http://savannah.nongnu.org/bugs/download.php?file_id=47738>

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?57114>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]