Sergey's Lemmy
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
PandaDEV@lemmy.ml to Programmer Humor@lemmy.ml · 2 years ago

unsafeCode

lemmy.ml

message-square
20
link
fedilink
  • cross-posted to:
  • programmer_humor@programming.dev
373

unsafeCode

lemmy.ml

PandaDEV@lemmy.ml to Programmer Humor@lemmy.ml · 2 years ago
message-square
20
link
fedilink
  • cross-posted to:
  • programmer_humor@programming.dev
  • stebo@lemmy.dbzer0.comdeleted by creator
    link
    fedilink
    arrow-up
    9
    ·
    2 years ago

    besides not requiring a return value, what difference does it make?

    • Oriel Jutty :hhHHHAAAH:@infosec.exchange
      link
      fedilink
      arrow-up
      9
      ·
      2 years ago

      @stebo02 @Bogus5553 Neither of them require a return value, but void main isn’t legal C++.

      • stebo@lemmy.dbzer0.comdeleted by creator
        link
        fedilink
        arrow-up
        2
        ·
        2 years ago

        yeah I thought so, does it work in C?

        • Bogus5553@lemm.ee
          link
          fedilink
          arrow-up
          4
          ·
          2 years ago

          void main(){...} is not in the standard, but works on both MSVC and GCC (with warnings). I think it works on both C/C++, but you really shouldn’t use it in production. Just use int main(void){...} , without any return value, which is permitted in the standard, and will return success iirc.

    • Buddahriffic@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      2 years ago

      It will also give an error if you try to add a return value anyways.

Programmer Humor@lemmy.ml

programmerhumor@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: !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.
Visibility: Public
globe

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

  • 5 users / day
  • 75 users / week
  • 1.37K users / month
  • 5K users / 6 months
  • 1 local subscriber
  • 43.2K subscribers
  • 2.05K Posts
  • 41.9K Comments
  • Modlog
  • mods:
  • AgreeableLandscape@lemmy.mldeleted by creator
  • cat_programmer@lemmy.ml
  • BE: 0.19.20
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org