I have a problem when optimizing code, and it seams that the reason is an inline function.
Is there a way to prevent optimization of an inline function?
Asked
Active
Viewed 2,739 times
2

Forge
- 6,538
- 6
- 44
- 64

Erik Sapir
- 23,209
- 28
- 81
- 141
-
1[Related question](http://stackoverflow.com/questions/5625624). – zoul Feb 23 '12 at 15:34
-
It could be a bug in the optimizer, but it could also be a bug in the code. When a program has undefined behavior one result could be that it works fine without optimization off but crashes with optimization. Try enabling more warnings and turning on features like `-fcatch-undefined-behavior` and `-ftrapv` – bames53 Feb 23 '12 at 16:27
-
where should i put these flags? – Erik Sapir Feb 23 '12 at 18:18
-
@ErikSapir in the build settings for the project they should go in the 'other C++ flags' area, I think. (You're lucky I saw this. I didn't get any notification because you didn't say @bames53) – bames53 Feb 24 '12 at 22:55
1 Answers
2
This will stop a function being inlined:
__attribute__((noinline))
void method(int a) {
// Blah
}
If you mean actual optimisation level, then look at the question @zoul referred to.

Community
- 1
- 1

mattjgalloway
- 34,792
- 12
- 100
- 110