86thumbs
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
devilish666@lemmy.world to Programmer Humor@lemmy.ml · 1 year ago

C++ Moment

lemmy.world

message-square
153
fedilink
1K

C++ Moment

lemmy.world

devilish666@lemmy.world to Programmer Humor@lemmy.ml · 1 year ago
message-square
153
fedilink
  • WhiteHawk@lemmy.world
    link
    fedilink
    arrow-up
    47
    ·
    1 year ago

    Mixing spaces and tabs should be a warcrime.

    • pingveno@lemmy.ml
      link
      fedilink
      English
      arrow-up
      9
      ·
      1 year ago

      And in Python, it’s merely a SyntaxCrime.

    • merc@sh.itjust.works
      link
      fedilink
      arrow-up
      8
      arrow-down
      13
      ·
      1 year ago

      Find me anyone who claims they use tabs for indentation, and I bet I’ll find at least one case where they’re using both tabs and spaces.

      The only safe way to avoid war crimes is to avoid tabs.

      • HopFlop@discuss.tchncs.de
        link
        fedilink
        arrow-up
        10
        arrow-down
        3
        ·
        1 year ago

        Why would I use spaces if I use tabs? Also, it seemd like a huge waste of time hitting the space bar so many times…

        • merc@sh.itjust.works
          link
          fedilink
          arrow-up
          9
          arrow-down
          2
          ·
          edit-2
          1 year ago

          Why would I use spaces if I use tabs?

          To comply with Python’s best practices:

          https://peps.python.org/pep-0008/

          Also, if you work on the Linux Kernel, you’ll see a mix of tabs and spaces:

          https://elixir.bootlin.com/linux/latest/source/block/bfq-iosched.c#L390

          Also, it seemd like a huge waste of time hitting the space bar so many times…

          You use an editor that doesn’t auto-indent?

          • FlorianSimon@sh.itjust.works
            link
            fedilink
            arrow-up
            3
            ·
            edit-2
            6 months ago

            removed by mod

            • BeardedGingerWonder@feddit.uk
              link
              fedilink
              English
              arrow-up
              3
              arrow-down
              1
              ·
              1 year ago

              I use vi without syntax highlighting.

              • FlorianSimon@sh.itjust.works
                link
                fedilink
                arrow-up
                1
                ·
                edit-2
                6 months ago

                removed by mod

                • BeardedGingerWonder@feddit.uk
                  link
                  fedilink
                  English
                  arrow-up
                  2
                  arrow-down
                  1
                  ·
                  1 year ago

                  To be fair you can totally bind an arbitrary number of spaces to tab in vi. I’ll dig out the syntax highlighting file some time. Oh and I use vim really.

                  • FlorianSimon@sh.itjust.works
                    link
                    fedilink
                    arrow-up
                    2
                    ·
                    edit-2
                    6 months ago

                    removed by mod

        • elauso@feddit.de
          link
          fedilink
          arrow-up
          1
          ·
          1 year ago

          deleted by creator

      • dotMonkey@lemmy.world
        link
        fedilink
        arrow-up
        8
        arrow-down
        1
        ·
        1 year ago

        I use the tab key but I’m pretty sure vs code converts that to spaces

        • gears@sh.itjust.works
          link
          fedilink
          arrow-up
          4
          ·
          1 year ago

          Depends on your settings, but yeah typically it does

          • merc@sh.itjust.works
            link
            fedilink
            arrow-up
            2
            arrow-down
            1
            ·
            1 year ago

            It worries me that a programmer wouldn’t know for sure what’s happening when they hit tab, and that it’s a setting that can be changed.

            • dotMonkey@lemmy.world
              link
              fedilink
              arrow-up
              2
              ·
              1 year ago

              I mean I was 99% sure it convert to spaces, I cannot say I was certain. The default settings are fine for what I do, I only ever had to change the spacing from 4 to 2 spaces once when dealing with someone else’s files

      • Holzkohlen@feddit.de
        link
        fedilink
        arrow-up
        8
        arrow-down
        1
        ·
        1 year ago

        Don’t IDEs just replace any tab with 4 spaces anyways? Pretty sure VSCode does

        • _dev_null@lemmy.zxcvn.xyz
          link
          fedilink
          arrow-up
          4
          ·
          1 year ago

          I    don’t    use    an    ide,    but    I    wrote    a    script    that    replaces    any    space    I    type    with    four.

          I    haven’t    worked    out    all    the    use    cases    yet,    though.

        • merc@sh.itjust.works
          link
          fedilink
          arrow-up
          3
          arrow-down
          1
          ·
          1 year ago

          That’s a setting in the editor.

      • ramsay@lemmy.world
        link
        fedilink
        arrow-up
        3
        ·
        edit-2
        1 year ago

        Linux kernel?

        https://www.kernel.org/doc/html/v4.10/process/coding-style.html#indentation

        edit: oh python, nevermind

        • merc@sh.itjust.works
          link
          fedilink
          arrow-up
          2
          arrow-down
          1
          ·
          1 year ago

          The kernel definitely mixes tabs and spaces:

          https://elixir.bootlin.com/linux/latest/source/block/bfq-iosched.c#L390

Programmer Humor@lemmy.ml

programmerhumor@lemmy.ml

remote_follow_modal_title

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmerhumor@lemmy.ml

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
community_visibility: public
globe

public_blurb

  • 59 users / day
  • 521 users / week
  • 1.69K users / month
  • 10.5K users / 6 months
  • number_of_local_subscribers
  • 35.6K subscribers
  • 1.69K Posts
  • 36.8K Comments
  • Modlog
  • mods:
  • AgreeableLandscape@lemmy.ml
  • cat_programmer@lemmy.ml
  • UI: unknown version
  • BE: 0.19.5
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org