I appreciate rust as much as the next dev. But you can define your own types in C just as well? And with the proper warnings and errors -Wall -Werror in place, any warning is an error, and implicit conversions should probably be a warning right?
ETA: Just tried with the following C code and could not get it to fail with gcc.
typedef in C just make an alias to the same type. structs have nominal typing though:
// this typedef is optional to avoid having to refer to the struct tag when referencing the typestypedefstruct {int} t_0;
typedefstruct {long} t_1;
t_0 test() {
t_1 foo = {1};
return foo; // error
}
I appreciate rust as much as the next dev. But you can define your own types in C just as well? And with the proper warnings and errors
-Wall -Werrorin place, any warning is an error, and implicit conversions should probably be a warning right?ETA: Just tried with the following C code and could not get it to fail with
gcc.typedef int t_0; typedef long t_1; t_0 test() { t_1 foo = 1; return foo; }Tried with
gcc -Wall -Wextra -Wpedantic -Werrorand it compiled just fine.typedefin C just make an alias to the same type.structs have nominal typing though:// this typedef is optional to avoid having to refer to the struct tag when referencing the types typedef struct {int} t_0; typedef struct {long} t_1; t_0 test() { t_1 foo = {1}; return foo; // error }