3 ms·
I thought he was talking about functions defined within the same file or some such. Like: int square(int x) { return x*x; } int sum_of_squ
by inklesspen 18y ago
I thought he was talking about functions defined within the same file or some such.
Like:
int square(int x) {
return x*x;
}
int sum_of_squares(int x, int y) {
return square(x)+square(y);
}
And then the compiler could just know to turn that into
int sum_of_squares(int x, int y) {
return x*x + y*y;
}
(apologies if my syntax is invalid; I'm not actually a C programmer)
- boris 18y agoSteve is talking about the "link-time inlining" (see the original quote) which is not supported by any mainstream C compiler that I know. Inlining in the same translation unit is possible though its application is too limited to explain why C is faster than dynamically-typed languages.