Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
brahn15747yAccording to standard code convention the first is used in C#, the second in Java and several other languages.
As I enjoy pointing out: Code style depends on language AND on team agreement, and consistence in and across projects is far more important than which style you use. -
PHP:
public function getUser(int $id): ?User
{
...
}
I can't stand missing typehints, spaces or brackets in the wrong places, or snake_case. -
@FrodoSwaggins
Hey man I am 21 and currently catching up to speed with c++14 for my new job and wanted to know whether putting void in case of empty parameter list gives you any performance advantage or is it just for readability? -
Sweash1197yI got less points in test doing like
(){
}
My teacher sad correct way is like
()
{
}
Thats unbelievable 🤦♂️ -
sSam14837y@FrodoSwaggins yeah, I completely agree about auto keyword. It should be used only where the type is clearly clear. However, I don't see how this applies to the "void" keyword in function parameters.
-
@FrodoSwaggins + if you are writting C++, adding void will make the func compatible with C compilers. At least thats what SO says
-
inaba45897yI like the bottom one more since things start to make sense as to what belongs to what
-
@inaba If you're working on an open-source project done in C#, have fun with breaking standards.
-
inaba45897y@filthyranter Again, as long as you're consistent. That also mean you use what the reast of the project uses.
If you want an example of how not to do this, the source code to .net is a pretty good example -
@inaba Yeah, but if you have to use what the rest of the C# project uses, most of the time it's going to be the opening curly brace on a new line.
Related Rants
-
l0om44100% Real. And it's not even the worst on the site.
-
Codazed11Being 100% serious, I saw a guy in my Computer Programming I class using MS Word to write code that he would c...
-
dfox8I worked with a good dev at one of my previous jobs, but one of his faults was that he was a bit scattered and...
public void method()
{
// :(
}
instead of
public void method() {
// :)
}
bothers me more than it should
rant
wk99