Minecloud Lemmy
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
learnbyexample@programming.dev to Linux@lemmy.mlEnglish · 2 months ago

$HOME, Not So Sweet $HOME

gist.github.com

external-link
message-square
24
fedilink
83
external-link

$HOME, Not So Sweet $HOME

gist.github.com

learnbyexample@programming.dev to Linux@lemmy.mlEnglish · 2 months ago
message-square
24
fedilink
Home, Not So Sweet Home
gist.github.com
external-link
Home, Not So Sweet Home. GitHub Gist: instantly share code, notes, and snippets.
  • schnurrito@discuss.tchncs.de
    link
    fedilink
    arrow-up
    6
    ·
    2 months ago

    auto main() -> int

    What programming language is this even?!

    • HiddenLayer555@lemmy.ml
      link
      fedilink
      English
      arrow-up
      4
      ·
      edit-2
      2 months ago

      Why would anyone bother writing it like that? That just seems like int main() with extra steps. Like does auto enable some compiler optimisation of the return type that I’m not aware of?

      • Sonotsugipaa@lemmy.dbzer0.com
        link
        fedilink
        English
        arrow-up
        3
        ·
        2 months ago

        Defining the return type that way can be used when dealing with template sorcery - there’s no use for it here though, not even for readability in any way.

    • Scott@lem.free.as
      link
      fedilink
      English
      arrow-up
      3
      ·
      2 months ago

      Looks like C++.

      • schnurrito@discuss.tchncs.de
        link
        fedilink
        arrow-up
        4
        ·
        2 months ago

        TIL that you can declare return types this way in C++.

        • qaz@lemmy.world
          link
          fedilink
          English
          arrow-up
          2
          ·
          2 months ago

          I never understood why they added that

          • brisk@aussie.zone
            link
            fedilink
            arrow-up
            6
            ·
            2 months ago

            Among other things it lets you define the return type in terms of the arguments to the function.

          • _____@lemm.ee
            link
            fedilink
            English
            arrow-up
            5
            ·
            2 months ago

            because explicitly declaring types can be redundant, if the compiler knows a lot of the times you should also know

            also because some types are extremely cursed: see std views/ranges

          • Feyd@programming.dev
            link
            fedilink
            arrow-up
            3
            ·
            2 months ago

            They’re useful for templates because the trailing version is resolved later

Linux@lemmy.ml

linux@lemmy.ml

Subscribe from Remote Instance

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: !linux@lemmy.ml

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

  • Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
  • No misinformation
  • No NSFW content
  • No hate speech, bigotry, etc

Related Communities

  • !opensource@lemmy.ml
  • !libre_culture@lemmy.ml
  • !technology@lemmy.ml
  • !libre_hardware@lemmy.ml

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 1.25K users / day
  • 4K users / week
  • 8.29K users / month
  • 17.6K users / 6 months
  • 1 local subscriber
  • 54K subscribers
  • 7.59K Posts
  • 207K Comments
  • Modlog
  • mods:
  • nooter692@lemmy.ml
  • AgreeableLandscape@lemmy.ml
  • MarcellusDrum@lemmy.ml
  • Arthur Besse@lemmy.ml
  • Cyclohexane@lemmy.ml
  • d3Xt3r@lemmy.nz
  • BE: 0.19.7
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org