4 ms·
Regarding the first answer: What is called a "tentative definition" is of course a "declaration".
by shele 12y ago
Regarding the first answer: What is called a "tentative definition" is of course a "declaration".
- efaref 12y agoIndeed. I guess his title is correct for him, at least.
- sirclueless 12y agoThat's not actually true in this case. The author is correct about this. When "int i = 10;" is encountered, the tentative definition behaves effectively as a declaration. If the compiler were to reach the end of the translation unit and the variable i was never defined elsewhere, however, "int i;" serves as a definition.
- shele 12y agoIn think it is the other way around - the declaration is a tentative definition, so a definition unless there is a definition at file scope.
- ben0x539 12y agoIsn't a declaration "extern int i;"? Without the "extern", it's a definition, there's a symbol in that translation unit, etc.
- varjag 12y agoNo, it has nothing do with scope qualifiers. This is the same mechanism that used e.g. to declare recurrent structures.