Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
alyx17528yerror: C++ requires a type specifier for all declarations
main() {
^
1 error generated.
Compiler exited with result code 1 -
Forside14598yOk tried it a little. Actually this shit works. Not sure though what exactly the compiler is doing.
Using no return type compiles, using void works in gcc but g++ says, main() must return int. -
Forside14598y@Codebeard @alyx I have never seen anyone doing this and know C for punishing you for every little mistake, so I never even thought about trying this. Also I'm a very careful developer and always code as detailed as possible, so letting this out feels like peanutbutter without peanuts to me.
-
Forside14598y@alyx Well, noone stops you from using stdio.h in C++ as the compiler doesn't even give out a warning.
-
@Forside You were probably writing more C++ than C. I know, you can pick up some bad practices in C++ when C is concerned.
-
Forside14597y@Codebeard True. Started with C++ and later had to deal with C when writing for Arduino and Microchip. What I found most confusing, is that it's bad practice in C to cast malloc while it's impossible in C++ not to cast.
me:
#include<stdio.h>
main() {
printf("Hello World");
}
compiller:
undefined