为什么曾经仅在MS编译器上支持#pragma? [英] Why is #pragma once supported only on MS compilers?

查看:87
本文介绍了为什么曾经仅在MS编译器上支持#pragma?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常,当在开放源代码领域中的某个人有一个很好的主意并很好地实施时,开放源代码领域中的人们会尝试并尽可能地复制它. .网?单核细胞增多症. Photoshop? GIMP.苹果系统? GNOME.那么,为什么只有Microsoft编译器一次支持#pragma?微软是否获得了专利?还是开源社区实际上达成共识,那就是#ifdef MYHEADER_H #define MYHEADER_H/* mycode */#endif会更好吗?

Usually, when someone in closed-source land has a really good idea and implements it well, the folks in open-source land try and replicate it to the best of their ability. .NET? Mono. Photoshop? GIMP. Mac OS? GNOME. So why is it that only Microsoft compilers support #pragma once? Did Microsoft patent it or something? Or did the open-source community actually come to the consensus that #ifdef MYHEADER_H #define MYHEADER_H /* mycode */ #endif is somehow better? Not trying to troll here, just genuinely curious!

推荐答案

这基本上是什么:
http://en.wikipedia.org/wiki/Pragma_once [ 我认为问题不是"#once",而是"#ever" :-).在二十一世纪,我们还有"#include" –恭喜,女士们,先生们.

谢天谢地,即使在本机平台编程和最低级别的编程环境中,我也有足够的选择.

—SA
This is basically what it is:
http://en.wikipedia.org/wiki/Pragma_once[^].

It does not say it''s only Microsoft, it''s "non-standard but widely supported". The argument that C++ is ISO standard makes me Laugh Out Loud.
In my opinion, the problem is not "#once", the problem is "#ever" :-). We still have "#include", in XXI century — my congratulations, Ladies and Gentlemen.

Thanks goodness, I had enough alternatives even in the world of native-platform programming and in lowest level.

—SA


这篇关于为什么曾经仅在MS编译器上支持#pragma?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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