3 ms·
Strictly speaking he's correct as "definition" is distinct from "declaration", but yeah.
by stephencanon 4y ago
Strictly speaking he's correct as "definition" is distinct from "declaration", but yeah.
- WalterBright 4y agoI wrote definitions in the example, and the order dependence is clear.
- kragen 4y agoBut if you declare the foo function before main, it works correctly regardless of where it's defined. The definition just has the effect of also declaring it, which is what makes the difference. (Of course you know all this much better than I do, but someone younger reading this thread might be mystified.)
- WalterBright 4y agoThat wasn't the statement in the book, though. The thing is, this is a serious misfeature which isn't present in other languages, and can cause bizarre problems to the poor newbie user. This order dependency is why C source code tends to be written bottom-up, rather than the more natural top-down.
- kragen 4y agoAgreed on all four points.