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
0
votes
0 answers

Which implicit declarations are allowed / valid?

It is known that: implicit declaration of function is invalid implicit declaration of variable is invalid Which implicit declarations are allowed / valid? One example is identifier __func__. Are there other examples?
pmor
  • 5,392
  • 4
  • 17
  • 36
0
votes
3 answers

How to determine w/o conversions that a given floating constant can be represented?

How to determine w/o conversions that a given floating constant can be represented? Sample code: #define FLOATING_CONSTANT1 2147483647.0f #define FLOATING_CONSTANT2 2147483520.0f bool b1 = FLOATING_CONSTANT_CAN_BE_REPRESENTED( FLOATING_CONSTANT1…
pmor
  • 5,392
  • 4
  • 17
  • 36
0
votes
1 answer

Do unsupported standard features affect conformance?

Context: C compilers deliberately do not support some features while being conforming implementations. Is it ok? Some examples. All of the compilers down below are conforming implementations (__STDC__ is defined to 1). However: gcc does not support…
pmor
  • 5,392
  • 4
  • 17
  • 36
0
votes
1 answer

C function declaration linkage

I'm a bit confused with a topic in the C17 standard. In 6.2.2, point 5 you can read: If the declaration of an identifier for a function has no storage-class specifier, its linkage is determined exactly as if it were declared with the storage-class…
Pep
  • 625
  • 4
  • 19
0
votes
1 answer

Is there any C compiler able to detect the violation of a "strictly conforming program"?

Is there any C compiler able to detect* the violation of a "strictly conforming program"? * under some option, for example, --accept-only-strictly-conforming-program If no, then which tools to use to detect the violation of a "strictly conforming…
pmor
  • 5,392
  • 4
  • 17
  • 36
0
votes
0 answers

Aligning/Format Output Values in C17

visual studio 2019, C17 I can't figure out how to get the output as in the example with different input data. example 1 expected output: 1234 1234 123 123 example 2 expected output: 1234568912 1234568912 23456 23456 My…
Moon
  • 1
  • 2
0
votes
1 answer

If unary operators have near the highest priority, then why the order of evaluation of # and ## operators is unspecified?

Simple question: if unary operators have near the highest priority, then why the order of evaluation of # and ## operators is unspecified? Relevant to both C and C++. C11 (6.10.3.2 The # operator): The order of evaluation of # and ## operators is…
pmor
  • 5,392
  • 4
  • 17
  • 36
0
votes
0 answers

If FLT_HAS_SUBNORM is 0, then shall conversion (float)1E-45 return 0x1p-149?

Simple question: If FLT_HAS_SUBNORM is 0, then shall conversion (float)1E-45 return 0x1p-149? Reason of the question: ISO/IEC 9899:2011 (E) specifies behavior of FLT_HAS_SUBNORM / DBL_HAS_SUBNORM only wrt floating-point operations. According to…
pmor
  • 5,392
  • 4
  • 17
  • 36
0
votes
4 answers

C standard: structure and union specifiers: what is the exact definition of 'suitably converted'?

N2479 C17..C2x working draft — February 5, 2020 ISO/IEC 9899:202x (E) (emphasis added): 6.7.2.1 Structure and union specifiers 17    Within a structure object, the non-bit-field members and the units in which bit-fields reside have addresses that…
pmor
  • 5,392
  • 4
  • 17
  • 36
0
votes
0 answers

If the presence of subnormal numbers is optional (HAS_SUBNORM), then why the presence of FP_SUBNORMAL is mandatory?

If the presence of subnormal numbers is optional (HAS_SUBNORM feature macros), then why the presence of FP_SUBNORMAL classification macro is mandatory? Reason of the question: in this (still unanswered) question it was concluded / hypothesized…
pmor
  • 5,392
  • 4
  • 17
  • 36
0
votes
2 answers

Does -Wpedantic make the program follow the -std=version?

If I use gcc -std=c17, will -Wpedantic issue warnings for c17? Is this the same as ISO C?
user12184817
0
votes
2 answers

How to configure Codelite to compile a C program against C17/C18 standard

I am using Codelite 14.0.0 with the gcc.exe (MinGW.org GCC Build-2) 9.2.0 compiler. When I go to Menu > Workspace > Open Active Project Settings > Compiler> C Compiler Options... I can't see any option to make the compiler compile my C programs…
FlexMcMurphy
  • 420
  • 5
  • 21
0
votes
3 answers

Is C++17 based on C17?

I have noticed that many of the features new in C++17 were from C17. Is there any relation between the two standards? Are there any practical differences between the C functions and their C++ equivalents?
DexterHaxxor
  • 901
  • 6
  • 15
0
votes
3 answers

How can one calculate a pointer to the beginning of a struct from a pointer pointing at a member of the struct in a portable way?

Assume T1 and T2 are two types and the following struct is given: struct s { T1 x; T2 y; } Further, assume that we have an object of type struct s: struct s a; From this, we can calculate a pointer to the second struct member of the object: T2…
Marc
  • 4,327
  • 4
  • 30
  • 46
0
votes
2 answers

C18 sprintf() gives syntax error

I seem to have a syntax error on the line FSFILE *file; in the following code after adding the sprintf() line. The code worked up until i added the char text, textresult and sprintf(). I can't seem to find out what's wrong with it. I'm using the…