[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

The guy that Im working with on a project is using pic related

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 80
Thread images: 8

File: images.png (2KB, 173x195px) Image search: [Google]
images.png
2KB, 173x195px
The guy that Im working with on a project is using pic related style.
I am using the normal one.
It will cause us to kill each other wont it ?
>>
I use the pic related style. But I also have a space between foo and ()
>>
>>59315596
>I am using the normal one
You mean this one?

void 
foo()
{
// ...
}
>>
>>59315596

>the normal one

kys ... i like your collegue
>>
>>59315596
>write your stuff with your own style
>run clang-format on it with project specific settings

That's it.
>>
File: 1476388027375.jpg (34KB, 480x712px) Image search: [Google]
1476388027375.jpg
34KB, 480x712px
>>59315626
>>
>>59315676
silence heretic that is far to simple and reasonable
>>
If your tabs aren't properly aligned, it might cause a hash collision which could yield a false-positive on the machine learning cloud. I recommend you follow his lead to avoid these problems.
>>
Ask him if hes calling foo()\n and if not tell him to do it fuckin properly
>>
K&r style or die. Do you even know what k&r stands for? The gods mandated their style for a reason, because it's based as fuck.

I've yet to encounter ops pic style in the professional world and I hope I never do.

I was taught k&r style in high school in the 90s and in college.
>>
>>59315626
void
foo
(
int
arg)
{
if
(
condition)
foo(
arg);}
>>
putting braces on a separate line is useless almost all editors can find your mismatched braces.

void ayy(x, y)
try
{ lmao(x);
lmao(y); }
catch
{ ayy(y, x); }
>>
>>59315916
K&R chugs dick. Allman style is for all men; cakeboys need not apply.
>>
>>59315604
What the actual fuck?
>>
>>59316100
>hello world is > 1000 lines
>>
>>59315916
But K&R style has the opening brace on it's own line for function definitions you useless piece of shit.
>>
>>59315596
>I'm using the normal one
So your using the same one as him? What's the problem?
>>
everything except this:
int f(void){
// let the war begin
}

is retarded. sorry guys who use other style, you got memed. now its time to learn the proper style
>>
>>59316100
You are like a little baby
#include\
"stdio.h"

int
main
(
int
argc
,
char
*
argv
[
]
)
{
printf
(
"Hello"
" "
"World"
"\n"
)
;
return
0
;
}
>>
void foo() {

}


Any people who don't write code like above need to be brought out the back and summarily executed().
>>
>>59316441
ah, the pythonic way
>>
>>59316484
But what about this style:
void foo() }

{
>>
>>59316513
void foo)( }

{
>>
>>59315596
spoken like a true college/jobless/neet """programmer"""
>>
>>59315596
opening bracket on its own line for c#
opening bracket on the same line as the function heading for java
it's not that bloody difficult
>>
>>59315604
Why would you put a space there? I genuinely thought that was invalid in the interpreters for most procedural languages.

>>59315626
The braces aligned with the end of the parameter list?! You'd need 3 ultra wide 4K monitors to read an ordinary line of code. However I actually feel that you're onto something if the braces aligned with the end of the function name be it standard or user defined. I'd like to switch between this and vertically aligned tab style.
>>
File: right brace and terminators.jpg (10KB, 347x145px) Image search: [Google]
right brace and terminators.jpg
10KB, 347x145px
I've seen some things...
>>
>>59315604
foo() is not an anonymous function.
>>
File: 557.jpg (38KB, 680x793px) Image search: [Google]
557.jpg
38KB, 680x793px
>>59317048
>>
http://man.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man9/style.9?query=style
>>
>>59315596
who gives a fuck? go back masturbating to japanese cartoon before beginning a redundant discussion
>>
>>59315596
If there is already a significant codebase (either in this project or in related ones), standardise to whichever one is used more often. If you're just getting started, toss a coin and agree to use C style if it's heads and Java style if it's tails.
>>
>>59317048
this literally destroys me,
where is the readability?
>>
>>59317048
It looks like the dude was coming from Python so he wrote a sed script to add all of that.
>>
>not using your IDEs default settings
>>
>>59317048
holy kek
>>
>>59316552
void foo }{ (
)
>>
>>59315596

Yes, it will. You should always use the same style when working on the same project.

His approach is also objectively wrong because what he's doing is declaring an unspecified argument list, not a void one. Example:

void foo()
{
...
}

int main(void)
{
int a = 4;

foo(a);

return 0;
}


This redefines foo() to:

void foo(int a);


Which makes reading the program MUCH harder as part of the function definition is buried in whatever random place the call is, and then you also have to figure out the type of the arguments. It is also NOT a variable argument list, just unspecified, so you can't do any of these:

void foo()
{
...
}

int main(void)
{
int a = 4;

foo(a);
foo();

return 0;
}


void foo()
{
...
}

int main(void)
{
int a = 4;
float b = 3.14;

foo(a);
foo(b);

return 0;
}


void foo()
{
...
}

int main(void)
{
int a = 4;
float b = 3.14;

foo(a);
foo(b);

return 0;
}


void foo()
{
...
}

int main(void)
{
int a = 4;
int b = 7;
float c = 3.14;

foo(a, b);
foo(c);
foo(a);

return 0;
}


All of the above examples will throw a compiler error on modern compilers, and on old compilers it'll be undefined behavior. Function prototypes were added for a reason, so tell him to fucking use them.
>>
>>59317130
This. Doesn't matter how, but the earlier you agree on a coding standard, the better. It should include not only brace placement, but class names, variable names, when one should use statics etc. etc.
After doing that, don't whine about it. You're a professional for fuck's sake.
>>
>>59318211
void foo }(){
>>
>>59318581
>tfw Panjeet still doesn't understand basic variable naming conventions after working here for 2 years
>>
Just format code on git push
>>
>>59315876
You're retarded. Calling foo()\n would look like

foo()\n()
[\code]

Which doesn't make any fucking sense. Besidse by your logic you'd be calling foo(){ which doesn't work either.
>>
>>59318903
oh I fucked of the slash
>>
>>59318921
Protip: M-c
Also known as alt+c for lesser beings.
>>
>>59315626
If you use 2 spaces then GNU style is pretty great in my opinion.
>>
>>59317048
WHAT
>>
>>59317048
Clever
>>
File: vittu tärättää.jpg (8KB, 240x161px) Image search: [Google]
vittu tärättää.jpg
8KB, 240x161px
>>59317048
>>
>>59318522
Please, -never- teach anything to anyone.
>>
>>59317048
http://codegolf.stackexchange.com/questions/109995/convert-braces-to-right-hand-brace-sad-brace
incrudibub
>>
>>59315729
> whitespace causes a '''hash collision'''
>false positive on the machine learning cloud

No I will not accept this bait. 0/5.
>>
>>59318522
>Function prototypes were added for a reason, so tell him to fucking use them.
or, you know, just add void to the parameters
>>
>Use Visual Studio
>Common styling rules for the whole team enforced by ReSharper
>Press shortcut, receive automatic indentation and refactoring
>Life, life is good

Also that guy is right, because that style is right. It makes it much easier to actually see the block of code when parsing the code with your eyes.
>>
>>59320599
Smart, though...
"parsing the code with your eyes"
Adorable.
>>
>>59320599
The indentation isn't enough for you?
>>
func foo() {
fmt.Println(":^)")
}
>>
>>59320653
:3

From years of experience though, I stand by my statement. I've had to read massive JavaScript files sometimes, and the other curly brace style really messed up eyes it felt like things were all over the place and tracing the end brace to where it began was a pain without the IDE helping me.

>>59320676
Usually is, but the refactoring is nice too because it keeps everything consistent (variable names, removing unused using statements, etc...)
>>
>>59315596
>Not using lisp style
void foo()
{for (i = 0; i < 10; i++)
{if (i % 2 == 0)
{doSomething(i);}
else
{doSomethingElse(i);
(doThirdThing(i));}}}
>>
>>59320783
Do people ever write Lisp using C-style formatting?
>>
>>59320817
(define (foo)
(
(define i 0)
(if (= i 0) (
display 'fuck)
(
display 'shit)
)
i)
)
>>
>>59317163
this is why you learn a c type language first.
>>
>>59320745
Now you're actually honing in on a point, having to dart your eyes from the end of function's parameter list to another unpredictable place sounds like it would cause a form of RSI.
>>
>>59320783
Brace pile-up has ruined 1st year university students for a decade.
>>
:D
>>
Methods should always have newline bracketing.
Only Java retards don't agree.
>>
>>59321389
Why the inconsistency?
>>
>>59317048
I wrote unreadable oneliners on purpose for university assignments on courses that didn't require standards, this is nothing
>>
>>59322491
You special snowflake you
>>
>>59315626
void foo()
{ int x = atoi(gets());
const int y = 5;
x *= 2;
printf(x > y? "%d is more than %d\n" : "%d is less than %d", x, y); }
>>
>>59322712
thanks =)
>>
C:
void foo()
{
//
}

javascript and other high level stuff:
void foo() {
//
}
>>
>>59315596
Surely you just use whatever the current style is, or if it is a new project, whichever style you agreed on before hand. Right?
You're not actually brain damaged are you, anon?
>>
void foo(){ /*...*/}

>not putting method code in one line
you guys liek to waste the whitespace dont you
>>
>>59317048
PythonProgrammerTriesToAdjustToJava.jpg
>>
File: images.jpg (8KB, 262x192px) Image search: [Google]
images.jpg
8KB, 262x192px
>>59323167
>>
File: 1488951528868.jpg (17KB, 336x438px) Image search: [Google]
1488951528868.jpg
17KB, 336x438px
>>59322898
DELET
>>
File: 1488425470173.jpg (37KB, 500x401px) Image search: [Google]
1488425470173.jpg
37KB, 500x401px
void foo(){
//code
}

I agree OP, this is better. More effecient on space and more logical organization wise.

Anybody who actually believes that wasting whole lines for brackets makes sense should kill themselves. It's put in books to make them longer so that retards will think they're more comprehensive.
>>
>the normal one
There is no normal one. Various companies and various open source groups use different styles, especially in C-like languages. Some styles even try a hybrid approach, with the opening brace on a new line for functions, and on the same line for if/while/for statements.

In any case, talk to your partner about which brace style you two will both use, and stick with it. One of you will have to give in, and if it ends up being you, deal with it.
>>
>>59323187
python_programmer_tries_to_adjust_to_java.jpg
Thread posts: 80
Thread images: 8


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.