Sujet : Re: Two questions on arrays with size defined by variables
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.lang.cDate : 10. Feb 2025, 07:43:26
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <voc76f$13jns$1@dont-email.me>
References : 1 2 3 4 5 6 7 8
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 10.02.2025 05:14, Andrey Tarasevich wrote:
On Sun 2/9/2025 6:35 PM, Janis Papanagnou wrote:
The "return 0;" is unnecessary but harmless in C99 and later.
>
That - returning a value when a function is declared to return
one - is actually a [maybe picky] coding-habit of mine. :-)
This is, of course, a purely stylistic matter. But still... `main` is
special.
I know.
And it kinda makes sense to acknowledge it special nature by
not doing explicit `return 0` from `main`. `main` looks cleaner without it.
Now I'm astonished by that comment (to say the least).
I'm regularly returning status and error information to the calling
instance to act upon it. And you're saying that I should not return
any value? Or only values that are different from 0? Or only 0 if I
also return other values? - Whatever; that sounds all wrong to me.
Or is 'return' deprecated or depreciated and we should now rewrite
our source code and replace every 'return' by 'exit()', or use now
only 'exit()' in the first place instead?
I don't think you will convince me to not return 0 only because in
the special case that there's nothing specified the current language
standards defines that per default it implicitly provides that value
for me.
Janis