There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

noisytoot ,

Seven semicolons are the correct way to do indentation (it even alliterates):


<span style="color:#323232;">int main
</span><span style="color:#323232;">(void) {
</span><span style="color:#323232;">;;;;;;;printf("like thisn"); }
</span>
dystop ,

the correct way is to never indent and never use whitespace. Saves memory.

Your goal should be 1LOC every month, no more.

booty ,
@booty@hexbear.net avatar

all code should be written in one line with absolutely no breaks. it’s the most efficient way

gnuslashdhruv ,

Is this some kind of python meme I’m too C++ to understand?

Now, I’m completely willing to start a war about { going on the next line.

TheInsane42 ,
@TheInsane42@lemmy.ml avatar

Totally agree, all my { end up on the next line, 1st spot when starting a function, last character of the keyword when starting an if/for/… section. I even put the closing one on the same line when it’s single line, else either at the end of the closing line (when changing really old code) or same indent.

So indenting varies a lot, which makes most ‘new’ programmers go mental.


<span style="color:#323232;">while (my code)
</span><span style="color:#323232;">    { I'll do it my way }
</span><span style="color:#323232;">
</span><span style="color:#323232;">if (! liked)
</span><span style="color:#323232;"> { toughen-up }
</span><span style="color:#323232;">else
</span><span style="color:#323232;"> { get used to it
</span><span style="color:#323232;">   multi-line can go both ways...
</span><span style="color:#323232;"> }
</span>

That is, unless the font used messes it up. ;)

demonen ,
@demonen@lemmy.ml avatar

I use tabs because I prefer 4-space indents and others might prefer 2-space indentation or the gross and unacceptable 6-space indentation.

If more than one person is working on a code base, there will likely be more than one preference, and with tabs everyone gets to just set their own tab width.

Yes, even the 3-space savages.

noisytoot ,

Tabs work fine as long as you don’t align stuff. If you do, you have to assume a tab size and mix tabs and spaces.

gun ,
@gun@lemmy.ml avatar

This is a legit observation. However, I would argue that spaces needs a set indentation width anyway, so if tabs had a set indentation width that coders are expected to maintain when aligning code, it wouldn’t make a difference. Enforcing that in practice may be different, but in theory it works.

edward ,

Generally aligning stuff isn’t nice. But if you do, it’s tabs up to whatever level of indentation you’re at then spaces the rest of the way. So you wouldn’t have to assume a tab size. And the tabs and spaces have different semantic meaning (indent vs alignment) so mixing them makes sense. It’s even built into Jetbrains IDEs, where it’s called “Smart Tabs”.

https://lemmy.ml/pictrs/image/2b14b960-5c9c-4d3a-9f54-cc390e991378.png

Although really just adding a level of indent is better than aligning.

https://lemmy.ml/pictrs/image/9aa8acc8-3035-403d-bebc-edcb322418ad.png

UpperBroccoli ,

[ ] tabs [ ] spaces [x] why would I even care, I press tab and the editor puts either a tab or a number of spaces, couldn’t care less…

Lanthanae ,
@Lanthanae@lemmy.blahaj.zone avatar

I’d imagine it’s because people who use spaces are either further in their career in average (because the modern programming ecosystem in general uses tabs so new devs are more likely to only know that) or they’re just more serious about software development because the kind of person to die on that hill is also the kind of person who is very obsessive about other things as well.

aaaantoine ,

That’s because these programmers are getting paid by the character.

This is also why Java dev pays so well.

ReakDuck ,

System.out.println(“Wow, so little amount of characters to print this!”);

Grishaix ,
@Grishaix@feddit.de avatar

std::cout << “Wow, so little amount of characters to print this!” << std::endl;

ElectronSoup ,

std::puts("Why do so many C++ programmers not use the right tool for the job?");

Eavolution ,
@Eavolution@kbin.social avatar

Or the slightly more readable brainfuck:

++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.

ReakDuck ,

Hey! Brainfuck is a fun puzzle language and nothing someone does at a job to do money per character. Would be funny if yes

Grishaix ,
@Grishaix@feddit.de avatar

But you get smaller files with Tabs: madskristensen.net/…/performance-of-tabs-vs-space… ;)

OsrsNeedsF2P OP ,

Imagine not using a minifier

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines