Safe code is a skill, not a feature.
Strictly speaking, it should be
Unsafe block syntax in C++
{ ...}
i will never forgive C for making the type syntax be
char* args[]
instead of the much more reasonable
&[char] args
it also bothers me that
char* args[]
andchar c
are “the same type” in the sense that the compiler lets you writechar c, *args[5];
with no problems. i think the C languages would be way easier to learn if they had better type syntax. don’t even get me started on C++ adding support for
auto fn_name() -> ReturnType { … }
@affiliate Hey, you didn’t even mention that
char *args[]
actually meanschar **args
in a parameter list.god, what a beautiful language. it brings a tear to my eye
That is why I use just
int main(){...}
without arguments instead.Any
void main(){...}
enjoyers?besides not requiring a return value, what difference does it make?
@stebo02 @Bogus5553 Neither of them require a return value, but
void main
isn’t legal C++.yeah I thought so, does it work in C?
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 useint 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.