86thumbs
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
PandaDEV@lemmy.ml to Programmer Humor@lemmy.ml · 8 个月前

unsafeCode

lemmy.ml

message-square
20
fedilink
365

unsafeCode

lemmy.ml

PandaDEV@lemmy.ml to Programmer Humor@lemmy.ml · 8 个月前
message-square
20
fedilink
  • stebo@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    8
    ·
    8 个月前

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

    • Oriel Jutty :hhHHHAAAH:@infosec.exchange
      link
      fedilink
      arrow-up
      9
      ·
      8 个月前

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

      • stebo@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        2
        ·
        8 个月前

        yeah I thought so, does it work in C?

        • Bogus5553@lemm.ee
          link
          fedilink
          arrow-up
          4
          ·
          edit-2
          8 个月前

          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
      ·
      8 个月前

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

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

  • 85 users / day
  • 697 users / week
  • 2.13K users / month
  • 7.82K users / 6 months
  • number_of_local_subscribers
  • 38.7K subscribers
  • 1.87K Posts
  • 39.2K Comments
  • Modlog
  • mods:
  • AgreeableLandscape@lemmy.ml
  • cat_programmer@lemmy.ml
  • UI: unknown version
  • BE: 0.19.5
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org