Questions tagged [c17]

C17 is the informal name of the current standard (ISO/IEC 9899:2018) of the C programming language. It replaces C11, but introduces no new features. Instead the focus of C17 has been to resolve defect reports (DRs).

Important Note: All C related questions, shall be tagged as , and then as a complement, each should specify the version of the standard it is using. In case of the current standard, this complement should be the tag. Please see the tag for details.

Detection

A standard macro __STDC_VERSION__ is defined with the value 201710L to indicate that C17 support is available.

More Info:

64 questions
3
votes
3 answers

If 'float'<= INT_MAX is true, then why (int)'float' may trigger undefined behavior?

Sample code (t0.c): #include #include #define F 2147483600.0f int main(void) { printf("F %f\n", F); printf("INT_MAX %d\n", INT_MAX); printf("F <= INT_MAX %d\n", F <= INT_MAX); if…
pmor
  • 5,392
  • 4
  • 17
  • 36
3
votes
2 answers

If the next representable value after -0.0 is +0.0, then why nextafter(-0.0, INFINITY) does not return +0.0?

If the next representable value after -0.0 is +0.0, then why nextafter(-0.0, INFINITY) does not return +0.0?
pmor
  • 5,392
  • 4
  • 17
  • 36
3
votes
1 answer

Why converting 'out of range integer to integer' leads to IB, but converting 'out of range floating-point to integer' leads to UB?

Follow-up question for: Type casting: double to char: multiple questions Assigning an unsigned value to a signed char Context: ISO/IEC 9899:202x (E) working draft — February 5, 2020 C17..C2x N2479 (emphasis added): J.3 Implementation-defined…
pmor
  • 5,392
  • 4
  • 17
  • 36
3
votes
2 answers

Why open-std.org still lists C11 as the latest version of C?

I know, that the latest official standard revision is avaliable at: https://www.iso.org/standard/74528.html But since the page related to C language Working Group at http://www.open-std.org - http://www.open-std.org/JTC1/SC22/WG14/ claims, that it…
2
votes
2 answers

If "shall / shall not" requirement is violated, then does it matter in which section (e.g. Semantics, Constraints) such requirement is located?

If "shall / shall not" requirement is violated, then does it matter in which section (e.g. semantics, constraints) such requirement is located? Reason of the question: this opinion: This is in a Semantics section of the standard, not Constraints,…
pmor
  • 5,392
  • 4
  • 17
  • 36
2
votes
1 answer

F.3 Operations, 9 lists 5 FE_ macros followed by 4 IEEE 754 rounding-direction attributes ending up with "respectively": mistake?

N2479 C17..C2x working draft — February 5, 2020 ISO/IEC 9899:202x (E): F.3 Operations, 9: The macros (7.6) FE_DOWNWARD, FE_TONEAREST, FE_TONEARESTFROMZERO, FE_TOWARDZERO, and FE_UPWARD, which are used in conjunction with the fegetround and…
pmor
  • 5,392
  • 4
  • 17
  • 36
2
votes
1 answer

Is it possible to determine at compile time whether an implementation provides exact-width integer types?

Is it possible to determine at compile time whether an implementation provides exact-width integer types? Sample code (wanted): #include #if HAS_EXACT_WIDTH_INTEGER_TYPES uint32_t i; #else /* handle the case */ #endif Reason of the…
pmor
  • 5,392
  • 4
  • 17
  • 36
2
votes
1 answer

Are HAS_SUBNORM and __STDC_IEC_559__ dependent?

Are HAS_SUBNORM and __STDC_IEC_559__ dependent? For example: If __STDC_IEC_559__ is 1, then HAS_SUBNORM is 1. If HAS_SUBNORM is 0, then __STDC_IEC_559__ is not 1.
pmor
  • 5,392
  • 4
  • 17
  • 36
2
votes
3 answers

Is the term "format specifier" a synonym for term "conversion specifier"?

Both the C11 and C17 standards use terms “conversion specifier” and “format specifier”. Are they synonyms? If yes, then why introducing the synonyms? If no, then what is the difference between them?
pmor
  • 5,392
  • 4
  • 17
  • 36
2
votes
2 answers

What rules are there for qualifiers of effective type?

So I was re-reading C17 6.5/6 - 6.5/7 regarding effective type and strict aliasing, but couldn't figure out how to treat qualifiers. Some things confuse me: I always assumed that qualifiers aren't really relevant for effective type since the rules…
Lundin
  • 195,001
  • 40
  • 254
  • 396
2
votes
5 answers

Bitwise & over 32 bits

#include #include int main() { unsigned long long a = 9223372036854775808; // a = 2^63 a = a & ~1; printf("%llu\n", a); printf("%d, %lld", INT_MAX, LLONG_MAX); } Output 9223372036854775808 2147483647,…
op ol
  • 705
  • 4
  • 11
2
votes
1 answer

Should we call it C17 or C18?

ISO 9899:2018 has been available for some time now from ISO. List of changes: What is C17 and what changes have been made to the language? Informally this version of the standard has been called C17 for some time, though the ISO document will be…
Lundin
  • 195,001
  • 40
  • 254
  • 396
2
votes
1 answer

snprintf: Are there any C Standard Proposals/plans to change the description of this func?

Are there any Proposals (or plans) to the C language Standard to change the (last sentence of the) description of the snprintf function such that the ambiguity described in this my answer to the question - "Is snprintf() ALWAYS null terminating?"-…
Robin Kuzmin
  • 742
  • 4
  • 12
1
vote
0 answers

No output for MSVC 2015! What to do? Should I change the C Standard on IDE?

Here's the c code: #include typedef char charray5[5]; charray5 carr1 = { 'a', 'b', 'c', 'd', '\0' }; charray5 carr2 = { 'q', 'w', 'e', 'r', '\0' }; charray5 carr3 = { 'x', 'y', 'z', 'w', '\0' }; charray5* func1() { return &carr1;…
1
vote
0 answers

How to do closest guess on C99, C11 or C17?

I have a source code of C-project that has more than 600 c-files in it and it compiles for ARM mcu using GCC toolchain. I wonder how can I make a closest guess about which of the C standard this c-project is compliant to among C99, C11 and C17?
Marina
  • 13
  • 4