Sujet : Re: Baby X is bor nagain
De : richard.nospam (at) *nospam* gmail.invalid (Richard Harnden)
Groupes : comp.lang.cDate : 29. Jun 2024, 19:46:56
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v5phah$168u$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
User-Agent : Mozilla Thunderbird
On 29/06/2024 15:14, bart wrote:
[...]
My older bcc compiler reported 4 as a hard error unless an override was used.
But you didn't say anything about main's args.
Make that 'int main(void)', then it does what you'd expect:
bart.c:17:5: error: too many arguments to function ‘main’
17 | main(123); // 4 Unchecked arg types
| ^~~~
bart.c:13:5: note: declared here
13 | int main(void) {
| ^~~~
[...]
-------------------------
#include <stdio.h>
#include <stdlib.h>
int F(void) {
return; // 1 No value
}
int G(void) {
if (rand())
return 0;
} // 2 Possibly running into end
int main() {
char s[10];
char *p = &s; // 3 Wrong types
main(123); // 4 Unchecked arg types
}
-------------------------