Does enables conformance mean: Flags non conformance?
On 5/23/2024 1:23 AM, Paavo Helde wrote:
On 23.05.2024 02:44, olcott wrote:
Does enables conformance mean: Flags non conformance?
No. Enabling conformance means enabling support for the conforming
features.
Flagging non-conformance is not possible in general as there are more
creative fools out there than there are compiler writers.
There are zillions of ways to write non-conforming code, for example
an endless loop is not conforming in C++. The compiler is not obliged
to diagnose it, but it is allowed for the compiler to silently
optimize the non-conforming code away, assuming it is never called. At
least that's what g++ folks think.
I would think that syntactically non-conforming code could be
flagged by the parser.
There are zillions of ways to write non-conforming code, for example an endless loop is not conforming in C++.
... The compiler is not obliged to
diagnose it, but it is allowed for the compiler to silently optimize the non-conforming code away, assuming it is never called. At least that's
what g++ folks think.
On 5/23/2024 9:43 AM, David Brown wrote:
On 23/05/2024 16:18, olcott wrote:
On 5/23/2024 1:23 AM, Paavo Helde wrote:
On 23.05.2024 02:44, olcott wrote:
Does enables conformance mean: Flags non conformance?
No. Enabling conformance means enabling support for the conforming
features.
Flagging non-conformance is not possible in general as there are
more creative fools out there than there are compiler writers.
There are zillions of ways to write non-conforming code, for example
an endless loop is not conforming in C++. The compiler is not
obliged to diagnose it, but it is allowed for the compiler to
silently optimize the non-conforming code away, assuming it is never
called. At least that's what g++ folks think.
I would think that syntactically non-conforming code could be
flagged by the parser.
Syntax errors and many types of constraint violations will be flagged
by the parser. But there are endless possibilities of non-conforming
behaviour that cannot be seen at compile time.
Does enables conformance mean: Flags syntactic non conformance?
/std:c11
The /std:c11 option enables ISO C11 conformance. It's available starting
in Visual Studio 2019 version 16.8.
/std:c17
The /std:c17 option enables ISO C17 conformance. It's available starting
in Visual Studio 2019 version 16.8.
On 5/23/24 02:23, Paavo Helde wrote:
...
There are zillions of ways to write non-conforming code, for example an
endless loop is not conforming in C++.
Citation, please? How does it fail to conform?
... The compiler is not obliged to
diagnose it, but it is allowed for the compiler to silently optimize the
non-conforming code away, assuming it is never called. At least that's
what g++ folks think.
The C standard contains the following wording:
"An iteration statement may be assumed by the implementation to
terminate if its controlling expression is not a constant expression200)
, and none of the following operations are performed in its body,
controlling expression or (in the case of a for statement) itsfexpression-3201) :
— input/output operations
— accessing a volatile object
— synchronization or atomic operations."
In essence, those restrictions mean that the body of the loop does
nothing that need take up any time, so it can be optimized to a nop. Infinitely many repetitions times 0 execution time has a product that is mathematically meaningless, but the C standard permits optimizing to terminate after a finite amount of time.
Note that this does not apply to endless loops occurring by other means,
such as goto.
On 23.05.2024 21:13, James Kuyper wrote:...
On 5/23/24 02:23, Paavo Helde wrote:
The C standard contains the following wording:
"An iteration statement may be assumed by the implementation to
terminate if its controlling expression is not a constant expression200)
, and none of the following operations are performed in its body,
controlling expression or (in the case of a for statement)
itsfexpression-3201) :
— input/output operations
— accessing a volatile object
— synchronization or atomic operations."
It looks like they have clarified the rules in the last standard, my
earlier draft (n4861) does not contain such verbiage.
In essence, those restrictions mean that the body of the loop does
nothing that need take up any time, so it can be optimized to a nop.
Infinitely many repetitions times 0 execution time has a product that is
mathematically meaningless, but the C standard permits optimizing to
terminate after a finite amount of time.
Note that this does not apply to endless loops occurring by other means,
such as goto.
The 4861 draft gives an implementation of a while loop in terms of GOTO
and says these are equivalent.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (2 / 14) |
Uptime: | 06:52:54 |
Calls: | 10,386 |
Calls today: | 1 |
Files: | 14,058 |
Messages: | 6,416,638 |