László Böszörményi (GCS), le mar. 25 mars 2025 17:01:24 +0100, a ecrit:
> On Tue, Mar 25, 2025 at 1:54 AM Samuel Thibault <sthiba...@debian.org> wrote:
> > Santiago Vila, le mar. 25 mars 2025 01:48:55 +0100, a ecrit:
> > > Does this reassign apply for every similar bugs?
> > > (I have some work to do, then).
> >
> > If it's the same error in the same header, most probably, yes.
>  With all due respect, please use common sense and do responsible
> thinking.

With all due respect, I did.

> Please note GNU GCC is a modern compiler and can detect which C++
> standard to use for a source tree.

Eh? How could it automagically do this?

For instance, this (I took the first example I could find, yes it's
deprecated but the point is still there) builds fine with -std=c++11

int main(void) {
        bool a;
        a++;
}

but doesn't without it (and not with -std=c++17). So yes, c++11 source
code may not just build as c++17, so just switching standard is not a
trivial thing that one can make without thinking about it.

> #include <unicode/localpointer.h>
> int main(void) {
> }
> tried to compile with "g++ test.cpp -o test -std=c++11" fails due to
> as it says: C++11 doesn't have such language elements.

What element?

My code uses int, main, void.

And includes some icu header. Is icu now really supposed not to support
C++ before 17?

That will really pose concerns, as the number of bugs shows.

> Just compile with "g++ test.cpp -o test" and it will work as it
> detects the code as C++17 and uses that C++ standard.

How can it automagically determine that it should be c++17, and not
c++11, or c++14, or c++20?

> Then if you still would like to force the C++ standard, compile with
> this: "g++ test.cpp -o test -std=c++17".

That's what I did: -std=c++11. Sure I can force -std=c++17 but then
5-10 years from now the problem will raise _again_ if icu starts using
C++-20-only features.

Library headers are supposed to cope with various standards, and not
impose them without thinking hard about it. C++17 is really quite
recent, not all source code can just build with it.

Samuel

Reply via email to