https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115907

--- Comment #12 from cqwrteur <unlvsur at live dot com> ---
(In reply to Andrew Pinski from comment #6)
> There is NO fix inside gcc/libstdc++.
> THe only fix is your build of GCC (which includes the target libraries)
> needs to be build against the oldest version of glibc you support. This is
> something which GCC cannot control.
> THIS IS HOW linking and backwards compatibility works.

Also if you don't think this is a bug. Explain this to me. Why C++ will use
__isoc23_sscanf but C does not?

#include <features.h>
#include <stdio.h>

int main() {
   const char *input = "42 Alice";
   int number;

   int result = sscanf(input, "%d", &number);

   printf("Parsed number: %d\n", number);

}

g++ -S hello.cc -std=c++11
g++ -S hello.cc -std=c++14
g++ -S hello.cc -std=c++17
g++ -S hello.cc -std=c++20
g++ -S hello.cc -std=c++23

Why they all use __isoc23_sscanf in the latest glibc 2.40.

If we compile it with gcc

gcc -S hello.c -std=c11
gcc -S hello.c -std=c14
gcc -S hello.c -std=c18
gcc -S hello.c -std=c23
Only C23 uses __isoc23_sscanf.

It does not make any sense tbh.

Reply via email to