Will compiler optimize out unused arguments of static function?
问题 I have a group of functions that are all declared static and fastcall . Most of them make use of a pointer to a struct that serves more or less the role of this in C++. Some of the functions don't need anything in the struct, but for uniformity sake I want to pass them the pointer anyway. Will the compiler notice that the argument is not used and omit allocating a register to it? 回答1: I wrote this nonsense program to test this. It's got some nonsense code in the function, and calls it several