Suppose I have two files:
== File1 ==
extern char* foo;
== File2 ==
double foo;
These two files seem to be compiling and are very well linked with g ++ and clang ++, despite the type mismatch. As far as I understand, the recommended practice is to put the extern declaration in the header, which both files include, so that File2 will cause an override error.
My questions:
undefined ++?
, , undefined ( ). , , . - , . , , decl/def (. 3.5, 7.5 "extern" "linkage" ), :
, .
, , , . , , , " undefined", UB - ( , , , , ). " " , , , FUBAR. , , , , , , .
?
, . ( ) , , , (, ), (), . , .
, , , , , , " , ".
, foo File1?
Uhm, , double foo; . , , NULL , , , - foo foo .
foo
, foo, . foo = malloc(100);, double foo , , , , , , 64- , , , , .
foo = malloc(100);
, "" , ++. , .
, - COULD , , . . .