Is #pragma once a safe include guard?

后端 未结 14 2522
青春惊慌失措
青春惊慌失措 2020-11-22 07:42

I\'ve read that there is some compiler optimization when using #pragma once which can result in faster compilation. I recognize that is non-standard, and thus

14条回答
  •  孤城傲影
    2020-11-22 08:04

    Not always.

    http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52566 has a nice example of two files meant to both be included, but mistakenly thought to be identical because of identical timestamps and content (not identical file name).

提交回复
热议问题