I’ve seen in many places that people often use the option -fomit-frame-pointer when compiling C / C++ code and I wonder, is the use of that option safe? What is it used for?
Thank you very much, best regards.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The option is safe but makes debugging harder. Normally, the C compiler outputs code which stores in a conventional register (
ebpon x86) a pointer to the stack frame for the function. Debuggers use that to print out local variable contents and other such information. The-fomit-frame-pointerflag instructs gcc not to bother with that register. In some situations, this can yield a slight performance increase, mostly due to reduced code footprint (that’s better for cache) and to the extra available register (especially on x86 in 32-bit mode, which is notoriously starved on registers).