什么是#pragma用于? [英] What is #pragma used for?

查看:155
本文介绍了什么是#pragma用于?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能帮助我理解#pragma?

Can anyone help me understand #pragma?

ifndef TARGET_OS_LINUX
#pragma once
endif

什么,何时,在哪里,为什么,一个例子?

What,when, where, why, an example?

上面是一些代码中,我正在重构....

The above is in some code that I am refactoring....

推荐答案

pragma 只是编译器特定功能的前缀。

#pragma is just the prefix for a compiler-specific feature.

在这种情况下, #pragma once 意味着此头文件将只在特定目标文件中包含一次。它不再需要包含警卫

In this case, #pragma once means that this header file will only ever be included once in a specific destination file. It removes the need for include guards.

这篇关于什么是#pragma用于?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆