Are redundant include guards necessary?

前端 未结 3 1025
野的像风
野的像风 2020-12-19 15:42

Are \'redundant include guards\' necessary in Codegear RAD Studio 2009? Is the compiler smart enough to deal with this on it\'s own?

For example, I might have the fo

3条回答
  •  长情又很酷
    2020-12-19 15:51

    The portion of the code you marked as "redundant include guard" is not necessary but it is a possible optimization.

    In the case of C++Builder, there is logic to detect header guards, so it should not be necessary.

    In the general case, the preprocessing pass is usually pretty fast anyhow, so it's unlikely that this optimisation would buy you much anyhow.

提交回复
热议问题