Date: Tue, 04 Feb 2025 15:07:41 -0800
On Tuesday 4 February 2025 14:08:40 Pacific Standard Time Frederick Virchanza
Gotham via Std-Proposals wrote:
> Another way to do it, in order to accommodate both 'old' and 'new'
> compilers, would be to put a comment after the inclusion directive,
> something like:
>
> #include <vector> // fwd[std::vector]
Let's not do that. Having something that works with both old and new
preprocessors (because this is what it is) is a recipe for trouble because it
would change what does become visible to the compiler. Or, for that matter,
for the preprocessor itself: will the above define __cpp_lib_ranges?
That's like the #pragma once discussion: the problem is not for the developer
of the code, but of whoever is using the code downstream of the developer.
Not to mention that it's a horrible idea to do it with a comment. This might
require major changes to it (I don't know whether comments are processed
before #includes are expanded) and it might collide with comments people
already put there. We don't want toolchains to suddenly start mis-interpreting
a comment added in 1993.
Gotham via Std-Proposals wrote:
> Another way to do it, in order to accommodate both 'old' and 'new'
> compilers, would be to put a comment after the inclusion directive,
> something like:
>
> #include <vector> // fwd[std::vector]
Let's not do that. Having something that works with both old and new
preprocessors (because this is what it is) is a recipe for trouble because it
would change what does become visible to the compiler. Or, for that matter,
for the preprocessor itself: will the above define __cpp_lib_ranges?
That's like the #pragma once discussion: the problem is not for the developer
of the code, but of whoever is using the code downstream of the developer.
Not to mention that it's a horrible idea to do it with a comment. This might
require major changes to it (I don't know whether comments are processed
before #includes are expanded) and it might collide with comments people
already put there. We don't want toolchains to suddenly start mis-interpreting
a comment added in 1993.
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Principal Engineer - Intel DCAI Platform & System Engineering
Received on 2025-02-04 23:07:44