public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/28963] New: New M_PIf macro broke some C++ code
@ 2022-03-14 13:02 jwakely.gcc at gmail dot com
  0 siblings, 0 replies; only message in thread
From: jwakely.gcc at gmail dot com @ 2022-03-14 13:02 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28963

            Bug ID: 28963
           Summary: New M_PIf macro broke some C++ code
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: jwakely.gcc at gmail dot com
  Target Milestone: ---

The new math constants added by 347a5b592c91f0230d52a5117fd83e1f75028207 for PR
28713 clash with a variable defined in the 0ad project:

../../../source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Environment/Environment.cpp:32:13:
error: expected unqualified-id before numeric constant
   32 | const float M_PIf = 3.14159265f;
      |             ^~~~~

It was fixed by renaming that variable:

https://github.com/0ad/0ad/commit/7df614338cbd41f5e254ce75f649490b2637e1d0

So this specific problem is fixed now, but more generally, adding 13 new macros
that don't use reserved names could be a problem. G++ automatically defines
_GNU_SOURCE on linux (because libstdc++ requires it) so any new macros added to
glibc that are defined when __USE_GNU will always be there for C++. And macros
without reserved names always risk breaking user code, because macros don't
respect namespaces.

Also IMHO mixed case names for macros are bad, they should be ALL_CAPS.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-14 13:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-14 13:02 [Bug math/28963] New: New M_PIf macro broke some C++ code jwakely.gcc at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).