counterargument regarding inline: even if the compiler does know better than you, you are still writing code for _other humans_ as well as the compiler. Even if inline doesn't do anything, it's a helpful hint for other programmers to know that the _intent_ was for the function to be inlined.
@D0Samp2 жыл бұрын
On the other hand there is link-time optimization which instructs the compiler to include call path information so the linker can perform the job of throwing away all known dead code. It works best with multiple compilation units sharing (mostly unused) library code and any level of optimization turned on (higher ones obviously favor more inlining). Still ends up a bit larger than removing everything yourself upfront in this example, but at least there are no library symbols left either. If you feel like cheating, you can also pass -fwhole-program on GCC with single compilation unit programs like these, which makes the compiler treat everything apart from main as not-actually-extern.
@Pi7on3 жыл бұрын
Congrats for 2k subs! Love your content!
@peterhutt48073 жыл бұрын
Great video Alexey, really informative
@randomsoul2942 жыл бұрын
Coming from a mathematical background I think that the hack you're using to not have scalar functions is more of a footgun than anything else.
@comradestinger7 ай бұрын
Hadamard multiplication is extremely useful in computer graphics. (blending colors, working with bounding boxes, operations on multidimensional arrays like pixels.)
@thegabriel38912 жыл бұрын
7:40 Russian Doomer music vol.9 (New Superior?)
@BradenBest2 жыл бұрын
You should add a macro to the generated header that specifies its semantic version, e.g. define LA_VERSION "1.0.1", or do it libc style 10001L
@Ansatz662 жыл бұрын
It seems very unfair to judge the final executable by looking at the object files. How can the compiler remove definitions from the object files when it doesn't know how those object files will be used? Only the linker can possibly know that some definition in some object file is never used. Clearly the linker is also not removing unnecessary functions from the final executable, but by only looking at the object files we're not even giving the linker its fair chance.
@GegoXaren2 жыл бұрын
You should add Generic Macros... All C standards over C11 support it. You can declare the functions as "UNUSED" using a macro, as is done in many C libraries. That will make the compiler not complain.