Hello world in C++ using stdio

>hello world in C++ using stdio
>disassemble, it's about 4 pages
>hello world in C++ using iostream
>disassemble, it's about 80 pages

Attached: 2349.png (576x453, 210K)

Other urls found in this thread:

github.com/fmtlib/fmt.
fmtlib.net/latest/api.html#printf-api)
open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0645r1.html#BinaryCode
twitter.com/SFWRedditGifs

I mean

When you think about it

Isn't it x86's fault?

>Use muh extensions
>Compiler becomes horribly bloated and insane just to squeeze 1-2%

Attached: 1522601586999.jpg (900x850, 162K)

Iostream is better because it's what i'm used to.

>try it
>c++ version is only 350 bytes larger
what kind of fucked up compiler you using OP

Attached: 2018-07-12-234004_1600x900_scrot.png (257x313, 27K)

Why both of the files are cpp?
Why are you using g++ to compile c?

reading comprehension

Take a look at the print function in python, coupled with all the abstractions the whole thing goes through, and C/++ are nothing compared to it. It's just more visable.

mines about 550K larger for iostream

Have you made sure you're building using -O3 or the equiv? and also its not news that iostream is pretty large and slowish (compared to stdio) but much more typesafe.

Try using github.com/fmtlib/fmt.
Its typesafe, fast and has normal function call syntax (versus iostream's

It also comes with a modern implementation of printf (fmtlib.net/latest/api.html#printf-api) which is faster due to using variadic templates (compile-time) vs VA_ARGS (run-time)

I don't have O3 in my compiler, it defaulted to Ot

>I don't have O3 in my compiler
Throw it into the trash right now

This is getting interesting.

>I don't have O3 in my compiler, it defaulted to Ot

Attached: 1518256907122.jpg (700x699, 101K)

Its the stdlib write your own print() and strlen() or dynamic link to the platform stdlib. I would do the former.

how do i implement that, is it a syscall? I've always used printf or iostream

if anyone is interested:

open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0645r1.html#BinaryCode

>they told me all Jow Forums does is fizzbuzz in C
>it's much, much worse than they thought

if you want it to be smaller then stop statically linking your c++
msvc is not a good compiler

both are me and if you combine that advice you have to deal with the fact that some dynamic linking on windows is actually broken (ie ship a folder full of MS-API_CORE blah blah blah dlls)

What shit compiler are you using? Try MinGW-w64 or Clang.

Who cares how big it is?
It's going to use only relevant parts of it?

msvc compadre

thought it was something like printf("hello world");

wtf.

Uninstall it. Isn't that the shit compiler that doesn't even support C99 and creates registry entries for how often an executable is ran?

yeah windows is shit, use a real OS that actually pins library versions so dynamic linking isn't just for gags

I like windows

Attached: 14664746971890.jpg (320x320, 19K)

i like your mom but i'm smart enough to know not to stick around at her house on nights and weekends

d-dad?

no, this is tyrone

i've never heard someone seriously try to argue that gcc > msvc

You're disgusting.

what if he said he like Mac/UNIX?

I never really understood assembly generated by C++ code. When you compile a C++ code that only contains a std::string for example, you will get a hundred lines of code in assembly.

that makes two of us

lurk more faggot

What don't you understand? It's linking to the std::string object that has a billion methods and dependencies, which all have their own methods and dependencies
It adds up quick
Go look at how much adding a vector adds

>std::string object that has a billion methods and dependencies
if you're looking at the disassembly it's supposed to have culled the unnecessary methods in the linker.

iostream is buffered and there is

It's a pain to reverse.

Attached: string.png (1251x738, 92K)

just write to stdout

Why aren't you using radare if you are "reversing it"?

>Use more abstractions for easier time coding
>Pay for it in resources
Truly surprising yes

What you are referring to is C. The non faggot programming language that is not bloated and not niggerlicious like C++. C++ is for faggots and pajeets. Your solution should be simple and elegant, most C++ programmers don't know this. Instead of doing the simplest solution they write some clusterfuck in C++

Attached: Untitled.png (995x382, 17K)

I use it. But it's always a pain to reverse even if we can see the strings.

Attached: radare.png (1283x728, 140K)

I've heard about radare before and learning some reverse engineering now, is it worth to look at?

>a solution in C
>simple and elegant
Choose one. C as a language is simple. Anything beyond fizzbuzz written in C is an atrocious clusterfuck.

Don't waste your time with radare it's unusable
Go download a copy of Ida, there was a 7.0 leak a while ago

Why radare is unusable?
I don't really want to use a proprietary software.

he would have invited me over 'for drinks'

Attached: 1512548029895.gif (240x228, 858K)

For comparison, bare minimum assembly on 64 bit Linux is 15 lines, 8 instructions:

.globl _start
.data
string:
.ascii "hello world!\n"
length=.-string
.text
_start:
movq $1, %rax
movq $1, %rdi
movq $string, %rsi
movq $length, %rdx
syscall
movq $0x3C, %rax
xorq %rdi, %rdi
syscall

do you even need to exit? can't you just continue and get segfault or something?

Sure, but then it's not comparable to something compiled.

could also just jmp . until the end of time, but that's not very good either.

It's too bloated, has a billion features that don't work well
I know one of the main contributors, and he doesn't even use it