Pricefield | Lemmy
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
@[email protected] to Programmer [email protected] • 4 months ago

unsafeCode

lemmy.ml

message-square
20
fedilink
  • cross-posted to:
  • [email protected]
388

unsafeCode

lemmy.ml

@[email protected] to Programmer [email protected] • 4 months ago
message-square
20
fedilink
  • cross-posted to:
  • [email protected]
  • @[email protected]
    link
    fedilink
    44•
    edit-2
    4 months ago

    That is why I use just int main(){...} without arguments instead.

    • @[email protected]
      link
      fedilink
      34•
      edit-2
      4 months ago

      Any void main(){...} enjoyers?

      • @[email protected]
        link
        fedilink
        1•4 months ago

        int main(void) { . . . } for me!

      • @[email protected]
        link
        fedilink
        5•4 months ago

        while (true) {...}

      • stebo
        link
        fedilink
        9•4 months ago

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

        • @[email protected]
          link
          fedilink
          2•4 months ago

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

        • Oriel Jutty :hhHHHAAAH:
          link
          fedilink
          9•4 months ago

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

          • stebo
            link
            fedilink
            2•4 months ago

            yeah I thought so, does it work in C?

            • @[email protected]
              link
              fedilink
              4•
              edit-2
              4 months 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.

    • CptKrkIsClmbngThMntn [any]
      link
      fedilink
      English
      6•4 months ago

      Very true, the less user input you have the safer your code will be.

Programmer [email protected]

[email protected]
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: [email protected]

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.
  • 40 users / day
  • 91 users / week
  • 414 users / month
  • 1.57K users / 6 months
  • 4 subscribers
  • 1.81K Posts
  • 38.4K Comments
  • Modlog
  • mods:
  • @[email protected]
  • @[email protected]
  • UI: 0.18.4
  • BE: 0.18.2
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org