public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104095] New: g++ diagnosis may use non-standard terminology: "constant" instead of "literal", "integer" instead of "integral"
@ 2022-01-18 13:51 pavel.morozkin at gmail dot com
  2022-01-18 14:11 ` [Bug c++/104095] " redi at gcc dot gnu.org
  2023-07-24  2:16 ` de34 at live dot cn
  0 siblings, 2 replies; 3+ messages in thread
From: pavel.morozkin at gmail dot com @ 2022-01-18 13:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104095

            Bug ID: 104095
           Summary: g++ diagnosis may use non-standard terminology:
                    "constant" instead of "literal", "integer" instead of
                    "integral"
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pavel.morozkin at gmail dot com
  Target Milestone: ---

$ g++ t589.cpp -std=c++17 -pedantic -Wall -Wextra -c
t589.cpp:24:22: error: overflow in constant expression [-fpermissive]
   24 | enum { y = (int)(1e10) };
      |                      ^
t589.cpp:24:22: error: overflow in constant expression [-fpermissive]
t589.cpp:24:22: error: enumerator value for ‘y’ is not an integer constant

С++ standard does not have "integer constant". С++ standard has "integral
constant".

$ g++ t589.cpp -std=c++11 -pedantic -c
t589.cpp:25:11: warning: use of C++17 hexadecimal floating constant
   25 | float f = 0x0.123p-1f;

С++ standard does not have "hexadecimal floating constant". С++ standard has
"hexadecimal floating literal".

$ g++ t589.cpp -std=c++17 -pedantic -c
t589.cpp:25:1: warning: floating constant truncated to zero [-Woverflow]
   25 | float f = 0x0.123333p-1000f;

С++ standard does not have "floating constant". С++ standard has "floating
literal".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/104095] g++ diagnosis may use non-standard terminology: "constant" instead of "literal", "integer" instead of "integral"
  2022-01-18 13:51 [Bug c++/104095] New: g++ diagnosis may use non-standard terminology: "constant" instead of "literal", "integer" instead of "integral" pavel.morozkin at gmail dot com
@ 2022-01-18 14:11 ` redi at gcc dot gnu.org
  2023-07-24  2:16 ` de34 at live dot cn
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2022-01-18 14:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104095

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Pavel M from comment #0)
> С++ standard does not have "integer constant". С++ standard has "integral
> constant".

The standard has "integral constant expression". There are only a handful of
uses of "integral constant" and they're arguably mistakes that should be
changed.

> С++ standard does not have "hexadecimal floating constant". С++ standard has
> "hexadecimal floating literal".

The standard has "hexadecimal-floating-point-literal".

> С++ standard does not have "floating constant". С++ standard has "floating
> literal".

The standard has "floating-point-literal".

Both of those cases are grammar productions. GCC's diagnostics do not
necessarily refer to that formal term, because they're user-facing, and not
part of a BNF grammar.

Not all programmers are familiar with the terminology of the standard. If a
simpler or more colloquial term exists, it might be more user friendly to use
that. In all cases above, the term used by GCC is shorter than the formal term
from the standard.

That said, I do think "floating constant" should be improved.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/104095] g++ diagnosis may use non-standard terminology: "constant" instead of "literal", "integer" instead of "integral"
  2022-01-18 13:51 [Bug c++/104095] New: g++ diagnosis may use non-standard terminology: "constant" instead of "literal", "integer" instead of "integral" pavel.morozkin at gmail dot com
  2022-01-18 14:11 ` [Bug c++/104095] " redi at gcc dot gnu.org
@ 2023-07-24  2:16 ` de34 at live dot cn
  1 sibling, 0 replies; 3+ messages in thread
From: de34 at live dot cn @ 2023-07-24  2:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104095

Jiang An <de34 at live dot cn> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |de34 at live dot cn

--- Comment #2 from Jiang An <de34 at live dot cn> ---
C standard says "floating constant" while C++ standard says "floating-point
literal".

I wonder whether it makes sense for gcc to say different standardese terms for
C and C++...

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-24  2:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-18 13:51 [Bug c++/104095] New: g++ diagnosis may use non-standard terminology: "constant" instead of "literal", "integer" instead of "integral" pavel.morozkin at gmail dot com
2022-01-18 14:11 ` [Bug c++/104095] " redi at gcc dot gnu.org
2023-07-24  2:16 ` de34 at live dot cn

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