@lily33@lemm.ee
link
fedilink
44
edit-2
1M

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

@Bogus5553@lemm.ee
link
fedilink
33
edit-2
1M

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

stebo
link
fedilink
81M

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

Oriel Jutty
link
fedilink
91M

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

stebo
link
fedilink
21M

yeah I thought so, does it work in C?

@Bogus5553@lemm.ee
link
fedilink
4
edit-2
1M

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.

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

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

while (true) {...}

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

Create a post

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.
  • 0 users online
  • 24 users / day
  • 59 users / week
  • 283 users / month
  • 1.97K users / 6 months
  • 1 subscriber
  • 1.72K Posts
  • 37.4K Comments
  • Modlog