在使用优化选项/O1/O2/O3时,有些函数会被优化去掉,有没有什么方法可以让指定函数不会被优化去掉?
在使用优化选项/O1/O2/O3时,有些函数会被优化去掉,有没有什么方法可以让指定函数不会被优化去掉?
1) For GCC, please try below method:
your code
to disable optimizations since GCC 4.4.
2) For Microsoft compiler, it also supports below grammar:
3)For ARM AC5/AC6, I do a quick go through but I don't find it. Maybe I miss it.
Anyway, you can try it as what GCC does.
4) The last method is to try a unnecessary "volatile" to your function.