What does the fpermissive flag do?

前端 未结 4 2162
孤城傲影
孤城傲影 2020-11-28 23:48

I\'m just wondering what the -fpermissive flag does in the g++ compiler? I am getting:

error: taking address of temporary [-fpermissive]<

4条回答
  •  日久生厌
    2020-11-29 00:03

    When you've written something that isn't allowed by the language standard (and therefore can't really be well-defined behaviour, which is reason enough to not do it) but happens to map to some kind of executable if fed naïvely to the compiling engine, then -fpermissive will do just that instead of stopping with this error message. In some cases, the program will then behave exactly as you originally intended, but you definitely shouldn't rely on it unless you have some very special reason not to use some other solution.

提交回复
热议问题