Jump to content

Which do you prefer?  

45 members have voted

  1. 1. Which do you prefer?

    • Nr. 1
      26
    • Nr. 2
      19


https://teespring.com/programmer-will-know#pid=212&cid=5819&sid=front

 

Will a programmer know?

I see most people use nr. 1, but I prefer nr. 2 - it makes everything more organized imo. 

Indent everything inside the brackets, and you can easily see what is inside the if-statement, and other loops, and methods etc etc. 

Running Arch with i3-gaps on a Thinkpad X1 Extreme
Data Science Postgrad

 

Link to comment
https://linustechtips.com/topic/548448-will-a-programmer-know/
Share on other sites

Link to post
Share on other sites

I always use the 2nd as well. Makes it easier for me to skim through it later if needed. 

Fine you want the PSU tier list? Have the PSU tier list: https://linustechtips.com/main/topic/1116640-psu-tier-list-40-rev-103/

 

Stille (Desktop)

Ryzen 9 3900XT@4.5Ghz - Cryorig H7 Ultimate - 16GB Vengeance LPX 3000Mhz- MSI RTX 3080 Ti Ventus 3x OC - SanDisk Plus 480GB - Crucial MX500 500GB - Intel 660P 1TB SSD - (2x) WD Red 2TB - EVGA G3 650w - Corsair 760T

Evoo Gaming 15"
i7-9750H - 16GB DDR4 - GTX 1660Ti - 480GB SSD M.2 - 1TB 2.5" BX500 SSD 

VM + NAS Server (ProxMox 6.3)

1x Xeon E5-2690 v2  - 92GB ECC DDR3 - Quadro 4000 - Dell H310 HBA (Flashed with IT firmware) -500GB Crucial MX500 (Proxmox Host) Kingston 128GB SSD (FreeNAS dev/ID passthrough) - 8x4TB Toshiba N300 HDD

Toys: Ender 3 Pro, Oculus Rift CV1, Oculus Quest 2, about half a dozen raspberry Pis (2b to 4), Arduino Uno, Arduino Mega, Arduino nano (x3), Arduino nano pro, Atomic Pi. 

Link to comment
https://linustechtips.com/topic/548448-will-a-programmer-know/#findComment-7245096
Share on other sites

Link to post
Share on other sites

The second one takes more lines, anything that takes more lines than it should pisses me off.

If you want to reply back to me or someone else USE THE QUOTE BUTTON!                                                      
Pascal laptops guide

Link to comment
https://linustechtips.com/topic/548448-will-a-programmer-know/#findComment-7245114
Share on other sites

Link to post
Share on other sites

I do 2, because I find it easier to see if the if statement is complete (so I know I didn't forget the first bracket for example)

 

"We're all in this together, might as well be friends" Tom, Toonami.

 

mini eLiXiVy: my open source 65% mechanical PCB, a build log, PCB anatomy and discussing open source licenses: https://linustechtips.com/topic/1366493-elixivy-a-65-mechanical-keyboard-build-log-pcb-anatomy-and-how-i-open-sourced-this-project/

 

mini_cardboard: a 4% keyboard build log and how keyboards workhttps://linustechtips.com/topic/1328547-mini_cardboard-a-4-keyboard-build-log-and-how-keyboards-work/

Link to comment
https://linustechtips.com/topic/548448-will-a-programmer-know/#findComment-7245115
Share on other sites

Link to post
Share on other sites

always use the first one, fucking hate it when people use the seccond...

Specs: CPU - Intel i7 8700K @ 5GHz | GPU - Gigabyte GTX 970 G1 Gaming | Motherboard - ASUS Strix Z370-G WIFI AC | RAM - XPG Gammix DDR4-3000MHz 32GB (2x16GB) | Main Drive - Samsung 850 Evo 500GB M.2 | Other Drives - 7TB/3 Drives | CPU Cooler - Corsair H100i Pro | Case - Fractal Design Define C Mini TG | Power Supply - EVGA G3 850W

Link to comment
https://linustechtips.com/topic/548448-will-a-programmer-know/#findComment-7245117
Share on other sites

Link to post
Share on other sites

I like the first (left). It just looks neater for some reason, than breaking up the code.

Join the Appleitionist cause! See spoiler below for answers to common questions that shouldn't be common!

Spoiler

Q: Do I have a virus?!
A: If you didn't click a sketchy email, haven't left your computer physically open to attack, haven't downloaded anything sketchy/free, know that your software hasn't been exploited in a new hack, then the answer is: probably not.

 

Q: What email/VPN should I use?
A: Proton mail and VPN are the best for email and VPNs respectively. (They're free in a good way)

 

Q: How can I stay anonymous on the (deep/dark) webzz???....

A: By learning how to de-anonymize everyone else; if you can do that, then you know what to do for yourself.

 

Q: What Linux distro is best for x y z?

A: Lubuntu for things with little processing power, Ubuntu for normal PCs, and if you need to do anything else then it's best if you do the research yourself.

 

Q: Why is my Linux giving me x y z error?

A: Have you not googled it? Are you sure StackOverflow doesn't have an answer? Does the error tell you what's wrong? If the answer is no to all of those, message me.

 

Link to comment
https://linustechtips.com/topic/548448-will-a-programmer-know/#findComment-7245123
Share on other sites

Link to post
Share on other sites

1 minute ago, as96 said:

Let me guess you made the shirt and you are now trying to advertise it without make it clear.

 

Anyway I usually use:


if(something)
{
	DoSomeWeirdStuff();
}

It's cleaner and I like it more.

No, actually not.

I was searching through to find some cool t-shirts to buy and stumbled upon this one. I was unsure what I was supposed to know :P

Running Arch with i3-gaps on a Thinkpad X1 Extreme
Data Science Postgrad

 

Link to comment
https://linustechtips.com/topic/548448-will-a-programmer-know/#findComment-7245134
Share on other sites

Link to post
Share on other sites

I use 1.  All those extra lines in each code block adds up to annoying me :D

2500k | Z68-UD3H-B3 | GTX 570 Classified + Accelero Xtreme III | MX 200 250GB + Seagate 500GB | R4 | Seasonic 660W Plattinum | 8GB G Skill | Acer K272HUL + 2 x Dell P2417H, Rosewill dual mount, HP 22bw | Mackie CR3, ATH-M50X | DAS Keyboard | Mobile: X1 Carbon, Nexus 6P, LG G3, Samsung S5, Nexus 7 (2013)

Link to comment
https://linustechtips.com/topic/548448-will-a-programmer-know/#findComment-7246239
Share on other sites

Link to post
Share on other sites

#define _ F-->00 || F-OO--;
long F=00,OO=00;
main(){F_OO();printf("%1.3f\n", 4.*-F/OO/OO);}F_OO()
{
            _-_-_-_
       _-_-_-_-_-_-_-_-_
    _-_-_-_-_-_-_-_-_-_-_-_
  _-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
  _-_-_-_-_-_-_-_-_-_-_-_-_-_
    _-_-_-_-_-_-_-_-_-_-_-_
       _-_-_-_-_-_-_-_-_
            _-_-_-_
}

 

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to comment
https://linustechtips.com/topic/548448-will-a-programmer-know/#findComment-7246524
Share on other sites

Link to post
Share on other sites

#1 for me but a space is needed between the brackets ... & excuse me but why wasn't the poll a choice of 0 & 1? :cP

 

Nearly all colleagues I've met and most of the online samples I see seem to favour the 2nd approach (I don't see the preference being 50/50) but what with the text editors & IDEs nowadays, matching any starting and closing braces is simple no matter where they're placed in any typical code.

 

Link to comment
https://linustechtips.com/topic/548448-will-a-programmer-know/#findComment-7248991
Share on other sites

Link to post
Share on other sites

On 15/2/2016 at 11:14 PM, Nineshadow said:

#define _ F-->00 || F-OO--;
long F=00,OO=00;
main(){F_OO();printf("%1.3f\n", 4.*-F/OO/OO);}F_OO()
{
            _-_-_-_
       _-_-_-_-_-_-_-_-_
    _-_-_-_-_-_-_-_-_-_-_-_
  _-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
  _-_-_-_-_-_-_-_-_-_-_-_-_-_
    _-_-_-_-_-_-_-_-_-_-_-_
       _-_-_-_-_-_-_-_-_
            _-_-_-_
}

 

I'll have nightmares forever now.

Link to comment
https://linustechtips.com/topic/548448-will-a-programmer-know/#findComment-7293666
Share on other sites

Link to post
Share on other sites

3 minutes ago, as96 said:

I'll have nightmares forever now.

Obfuscated nightmares at that.

Oh God.

 

Btw that code is actually really really interesting.

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to comment
https://linustechtips.com/topic/548448-will-a-programmer-know/#findComment-7293677
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×