I would like to have a few words with the retards shilling trailing type conventions (return type goes after function...

I would like to have a few words with the retards shilling trailing type conventions (return type goes after function signature) and attempting to shove this ugly unsavory crap down my throat
>"its verbose and looks like shit b-but i-its more readable"
Except it doesn't
Code syntax peaked with standard good old C
Why do nu-coders shill this retarded layout?

Attached: 67202068-503a9900-f3f7-11e9-8e62-44c3f9c733bb.png (727x849, 42.62K)

Other urls found in this thread:

en.m.wikipedia.org/wiki/Lexer_hack
stackoverflow.com/questions/27741348/make-the-meaning-of-for-dereference-and-dividing-not-for-commenting-by-adding
stroustrup.com/hopl2.pdf
xahlee.info/comp/why_i_hate_C_lang.html
twitter.com/NSFWRedditVideo

>Code syntax peaked with standard good old C
this. it's a fact.

If your complain is only about where the return type goes, you are less likely to know or understand anything beyond surface level.
Keep worshipping C, one day maybe you will write a useful program but I won't hold my breath.

enjoy your hideous soviet-bloc language.

you put the things that are mandatory on the left and the things that are optional and can be inferred on the right
simple as

>Code syntax peaked with standard good old C
C syntax is the worst.
thanks for the brain damaging syntax that is now littered everywhere
en.m.wikipedia.org/wiki/Lexer_hack
stackoverflow.com/questions/27741348/make-the-meaning-of-for-dereference-and-dividing-not-for-commenting-by-adding
stroustrup.com/hopl2.pdf
xahlee.info/comp/why_i_hate_C_lang.html

Attached: 324b5fc0877b45df961734cd36adcc3b.jpg (328x328, 18.84K)

trailing return type syntax has two primary uses user. one is, when you are working in a generic setting and you want to deduce the return type with the function arguments.

assume a function like the following (just a dumb example to demonstrate my point, don't take it too seriously)

template
decltype(std::declval() + std::declval()) add (T lhs, U rhs);


With trailing return syntax, function arguments are now visible to you, so you can just use them directly

template
auto add (T lhs, U rhs) -> decltype(lhs + rhs)


In this example, just using auto is also an option, but it has it's own set of problems regarding type safety, especially in pre C++20. Being explicit with your type in your function signature is a good practice, as it allows people to know what to expect from a function, and see the constraints on the types just by looking at the return type.
So, the main advantage of trailing return type syntax is that it allows function args. to be visible in the return type.

The second advantage is, imo it allows cleaner syntax when your function signature is too long. When the return type is too long, i like to use trailing return type and put the return type in the line below like this:

template
auto add (T lhs, U rhs)
-> some_very_long_and_ugly_return_type


The last one is just a personal preference, but I think it makes code more readable.

Of course, you can just use auto, but again, it has it's own set of problems regarding type safety. With C++20, now that we have concepts, you can put constraints and write code like:

std::integral auto f(std::integral auto val)


and this not only allows type safety, but it also gives information to the the user about the return type. just looking at the documentation or the snippet itself, you know what it returns

>let me write a function that creates memory and CPU overhead as a setter and getter instead of manipulating my structures directly
this is all java's and OOP languages fault

Attached: 1649609975818.png (751x684, 597.16K)

low IQ Any Forums NEET detected

>what is optimisation

Attached: 1.jpg (700x915, 101.96K)

you must be the kind of nigger to use is_even() instead of &1 masking

is 1.05 even?

you won't try to check if a float is even in any statically written lang

Go's syntax is the peak, but trying to retrofit type after identifier into C++ is stupid and unnecessary.

Forgot to mention one of the things that makes Go so good is that there's usually one way to write something. Why should a language support multiple ways to declare a function?

std::enable_if

>Why should a language support multiple ways to declare a function?
Yikes

Oof, that's a no from me senpai.

>declaring the return type at all

Attached: 1584113681184.png (686x526, 215.72K)

>Code syntax peaked with standard good old C
Why shouldn't int* x, y; declare two pointers to int?

Because you've been taught wrong. Here's an excerpt from "The C Programming Language" on declarators, written by the creators of the language.

Attached: p.png (664x303, 121.25K)

Why would anyone use &1? Is it the need to feel special?

Attached: Screenshot from 2022-07-30 20-33-19.png (3034x1447, 199.2K)

holy shit thats what I always suspected

C was never mentioned, fuck off with your troonlang.
and yes, I know how logic gates work and know how to use logical operators and don't want the compiler to do that for me

Attached: Screenshot_2022-07-30_12-37-58.png (419x139, 18.21K)