Cout is an abomination

change my mind

this meme was made my python/c gang

Attached: meme.jpg (1080x1080, 120K)

Other urls found in this thread:

github.com/fmtlib/fmt
twitter.com/NSFWRedditVideo

>this meme was made my python/c gang
Such
A
Gay
Example of a post.

System.out.print

Im not sure what's wrong with it. Do you hate the entire concept of streams in general?

You're forgetting the Fresh (Princ) of Lisp

Format strings are the superior way, easy to localize and manipulate. C got that right, C# got it a bit better allowing to change the order of variables however you want. String interpolation is a mistake. Cout is awful, cin though, sometimes I wish I had something like that in other languages, it just doesn't give a fuck about line breaks and spaces, it gives you the fucking value.

>printf
Uh what was it now %c %dc %ull %llu %bigint %AbstractCalculator::decltype().....

>cout
>just works

Okay lol.

printf format trings are convoluted and unnecessary if your language has any kind of compile time reflection (see fmt library).
Parsing them every time is also a good fit for partial compile time evaluatio (see h2o preprocessor).
printf is also designed to play around lack of type safety. Something that might have been a good solution to safe resources on pdp11 toaster, but not decades later.
The whole point of

also %n was a mistake

someone please break the hands of that cartoonist so he stops drawing.
His drawings are so fucking shit/cringe.

This.

Why do people think its acceptable to mock people just because they are in a poly relationship? The cartoonist guy just makes a whole range of bigoted nonsense...

This guy is so cringe.

Onions

the issue with streams is very similar to anything inside of stl, that being that it's just way too complicated.
have you ever tried debugging an exception thrown by std::vector or std::string? you walk through a ton of functions which are wrappers for other functions until you FINALLY end up finding what crashed you.
if you crash in printf you either gave it an incorrect variable or your string isn't null terminated and that's about it

also
std::cout

It is. IIOStreams were a mistake and everyone has already acknowledged that.
Why does it matter ,though? We have modern alternatives like github.com/fmtlib/fmt

>copying Rust

which copied another existing languages
tell me one bad thing about Rust's formatted print

Actually, your C++ example is not complete.
You did not reset the stream to the state it was before that call, which will have an affect on subsequent calls.

my point was more that C's printf is utter bullshit, not that C++ is good in any way
consider another alternative:
print("test {:x} {}\n", hexvalue, decvalue);

In statically typed language, types of hexvalue and decvalue are known at compile time.
With compile time evaluation (at least partial), static format string can be parsed and format tags checked on compile time, static arguments can be evaluated on compile time as well.
This feature is so desired and trivial to implement into sane language that GCC and clang developers implemented to that compiler at least does the type checks.
Even for integers - since C doesn't have builtin fixed-sized types you have to use workarounds to provide proper tag.
printf("test "PRIu32" "PRIi64" length %zd\n", u32value, s64value, len);

Please tell me how this is better in any way, especially since it's redundant and compiler already know all of this information.
Next there are bazillion of printf variants depending on what they print into, and the implementations have poor reusability. No sane way to provide custom format functions or alternative formatting for existing (e.g. escaping rules for string), no sane way to reuse the code for different destination of the format function (e.g. data structure, ring buffer, TLS wrapper for file descriptor of network connection).
C is fucking garbage.

>Please tell me how this is better in any way, especially since it's redundant and compiler already know all of this information.
C has an API and ABI to keep. How is an assembly program supposed to call the function you're proposing?
You're suggesting to add "magic" functions into C.
Also, just fucking use snprintf. You've printed into a string and can do whatever other special shit you want to.

Zoom zoom

Attached: 1547678861985.jpg (419x1024, 66K)

t. retard who doesnt know format specifiers or how to use man pages

Technically if you found the cartoon funny you would be the NPC according to your faggot zoomer meme.

But user everyone that does have the same political opinion as me is a NPC. It's an objective and undeniable fact

imagine being this much of a brainlet

which makes it even worse

the same way you would call any other generated function with parametric polymorphism, with type list being embedded in name and letting the compiler generate the proper function for this list

Are you fucking suggesting adding name-mangling to C? Are you fucking retarded?
The absence of that is one of the strongest advantages C has over absolutely everything else.

It doesn't even work here, because a print function has unlimited combinations of arguments.

it's not, name mangling provides type safety on link time
>It doesn't even work here, because a print function has unlimited combinations of arguments.
but you don't generate every possible combination, I don't see how this is an argument

You're a dumbass who doesn't understand the first thing about C or why people would want to use it.
There is no point continuing this.

>said nothing factually wrong
>hurrrr you're a dumbass who doesn't understand the first thing about C
nice try retard

C's well-defined (on each platform) and simple ABI is literally one of the most important things C does.
It's why literally every language has a C FFI (and usually no other FFI), and why people who actually want their libraries to be taken seriously write it in C, or at least provide a C-compatible interface.

Nobody wants to break that. Nobody would ever consider breaking thing.
You know nothing about why C is used and why it's still so relevant, and will continue to be so relevant.

also why would you want every function to be callable from assembly? there is a reason why you are already using a more capable language and there is no reason a whole language needs to suffer because every entry point could potentially be used from assembly
C's printf is indeed compatible. but so could dedicated function meant for ABI compatibility with assembly or C marked with directive to provide such guarantees

>>>/tumblr/

See

C's ABI is NOT well defined. standards provides close to no guarantees to layout of data types nor ABI. in C you have no control over what's passed through registers and what's passed through stack, both of which are valid options in SysV ABI.
All of it is implementation defined. All guarantees come from compiler. C compilers are good. C is fucking garbage. I've witnessed way too many libraries to be written in compiler's portable IR because it's unironically better language.

>C's ABI is NOT well defined
It's not standardised by ISO, but it is standardised for each platform.
But the ISO still knows that, and if you ever take the time to go over some of their documents (which you wouldn't do unless you're interested in the C standard), they very clearly place that ABI stability in right regard. They shoot down features which fuck with C's ability to have a stable ABI.
>in C you have no control over what's passed through registers and what's passed through stack, both of which are valid options in SysV ABI
It's a completely well-defined algorithm for what gets passed where.

The passing of arguments isn't particularly interesting/relevant here, but more the names that symbols have. In C, you have direct and proper control of symbol names.
my_fn doesn't become $aDASmy_fn12ASDf, and at worst, a leading underscore is consistently added to the front on some platforms.

>i don't know how it works
>therefore it is bad

Attached: winnie_the_pooh_glass.jpg (640x640, 54K)

The creator of this comic is a literal fascist.

>cringe
yikes

Programming socks really gayed up this board. Damn discord trannys.

>you walk through a ton of functions which are wrappers for other functions until you FINALLY end up finding what crashed you

doesn't this just consist of clicking through a stack trace? it would take 5-20 seconds to debug

who cares. If your shoes were made by a fascist would you stop wearing them?

Bitch

Attached: 1560296788837.png (1021x768, 922K)

imagine being such a brainlet that you can't write template-based library for generating type-safe printf format strings at compile time
imagine being such a retard that you still use plain C for software that needs formatted input/output in current year + 4

doesn't work like that, npc
use your atrophied brain

>Stonetoss
This is the shadman of political comics.

I would go out of my way to wear shoes made by fascists.

Good. We need more fascists to counter the increasing number of communists.