Date: Sun, 21 Jun 2026 14:16:10 +0200
On 2026-06-21 at 12:56, amngis_21d38 via Std-Proposals wrote:
> Why is Hello World for C++23 so large?
> Here are the binary sizes of the configurations I've tried.
> | Configuration | Binary Size |
> |---------------|-------------|
> | C++ (default) | 348K |
> | C++ (-O3) | 146K |
> | C (-O3) | 5.7K |
> Here is the bash shell.
> ~ $ cat print.cpp
> #include<print> int
> main() {std::print("Hello,world~\n");}
> ~ $ g++ print.cpp -o print
> ~ $ cat > puts.c << 'EOF'
> > #include <stdio.h> > int
> main() { puts("Hello,world~"); }
> > EOF ~ $ gcc
> puts.c -o puts -O3
> ~ $ ls -lh puts -rwx------. 1 u0_a296 u0_a296 5.7
> <tel:29657>K Jun 21 18:38 puts
> ~ $
>
Looks like apples and oranges to me.
std::print offers lots of formatting options, and validates the format
string before printing. Even if you have no explicit formatting, the
machinery is still there.
puts does none of that.
Have you tried std::puts in C++?
> Why is Hello World for C++23 so large?
> Here are the binary sizes of the configurations I've tried.
> | Configuration | Binary Size |
> |---------------|-------------|
> | C++ (default) | 348K |
> | C++ (-O3) | 146K |
> | C (-O3) | 5.7K |
> Here is the bash shell.
> ~ $ cat print.cpp
> #include<print> int
> main() {std::print("Hello,world~\n");}
> ~ $ g++ print.cpp -o print
> ~ $ cat > puts.c << 'EOF'
> > #include <stdio.h> > int
> main() { puts("Hello,world~"); }
> > EOF ~ $ gcc
> puts.c -o puts -O3
> ~ $ ls -lh puts -rwx------. 1 u0_a296 u0_a296 5.7
> <tel:29657>K Jun 21 18:38 puts
> ~ $
>
Looks like apples and oranges to me.
std::print offers lots of formatting options, and validates the format
string before printing. Even if you have no explicit formatting, the
machinery is still there.
puts does none of that.
Have you tried std::puts in C++?
Received on 2026-06-21 12:16:15
