cplusplus / CWG

Core Working Group
23 stars 7 forks source link

[lex.icon] It is unclear whether the choice of extended integer type is unspecified or implementation-defined #404

Open Eisenwave opened 1 year ago

Eisenwave commented 1 year ago

Full name of submitter: Jan Schultke

Reference (section label): [lex.icon]

Issue Description

In [lex.icon] p4, it is stated that:

Except for integer-literals containing a size-suffix, if the value of an integer-literal cannot be represented by any type in its list and an extended integer type ([basic.fundamental]) can represent its value, it may have that extended integer type.

It is unclear whether this choice of extended integer type is implementation-defined or unspecified.

Suggested Resolution

It makes logical sense for the implementation to document what type is chosen in such a case. If this behavior is documented, the user can reason about what types may be chosen for their integer-literals, which is obviously useful. The behavior should be implementation-defined.

[...] if the value of an integer-literal cannot be represented by any type in its list and an
+implementation-defined
extended integer type ([basic.fundamental]) can represent its value,
it may have that extended integer type.
tkoeppe commented 9 months ago

Please consider the editorial reworking of this text from https://github.com/cplusplus/draft/pull/6470 when drafting a resolution.