3 ms·
C is already much better, but we still have some boilerplate. Currently this is the bare minimum: #include <stdio.h> int main() { printf("Hello world\n
by teo_zero 4y ago
C is already much better, but we still have some boilerplate. Currently this is the bare minimum:
#include <stdio.h>
int main() {
printf("Hello world\n");
return 0;
}
But I wish we could get rid of that "boilerplate" #include. I think compilers could add it by themselves when needed (many already suggest it to you if you forget it, so they do know when it's the case).
On the other hand I wouldn't get rid of the explicit return from main(), as it has an important pedagogical function.
- JohnTordur 4y agoI disagree, #include <stdio.h> implies a system which has a stdout or stdin. That is not necessarily a case for embedded systems, where maybe at most you can blink an LED as a form of user output.
- teo_zero 4y agoI don't disagree, but the compiler could insert it automatically when you need it. In those rare cases where e.g. you want to use a function called printf() that's not the standard printf(), you explicitly opt out of the default via a compiler argument, a #pragma, etc.