GCC和枚举的前向声明

GCC和枚举的前向声明

本文介绍了GCC和枚举的前向声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我不得不使用GCC的新版本,使用下面的掷骰子 代码: enum E; enum E {e}; 也就是说,它不接受enum的前向声明。 C ++标准文本 没有明确说明enum的前向声明,但是一个例子 在18.2.1中显示它,第4节: enum float_round_style; enum float_denorm_style; 这是标准中的缺陷吗?Not quite new version of GCC that I have to use, craps with the followingcode:enum E;enum E { e };That is, it doesn''t accept forward declaration of enum. C++ standard textdoesn''t explicitly say about enum''s forward declaration, but one exampleshows it in 18.2.1, clause 4:enum float_round_style;enum float_denorm_style;Is it a defect in the standard?推荐答案 示例不是标准文本的一部分。它们是非规范性的。 但你所展示的不是一个例子,它是一个概要。含义 " outline",design,summary,conspectus。它不是C ++代码,而是一些代码的部分代码,显示了受标准管理的东西。 根据公共WG21网站那里对此没有任何问题。 我建议你在comp.std.c ++中询问这个C ++的原因,但是 格式错误的表示法。 /> - 阿提拉又名WWExamples are not part of the Standard text. They are non-normative.But what you do show is not an example, it is a synopsis. Meaning"outline", "design", "summary", "conspectus". It is not C++ code, but someparts of the code showing those things which are governed by the standard.According to the public WG21 web site there is no issue raised about this.I suggest that you ask in comp.std.c++ for the reasons of this C++ like, butill-formed notation.--Attila aka WW 不完整类型*不能*按值传递。对不起,但是你在这里和B / S说话。 那个B / S不是* Bjarne Stroustrup,但是与消化过程的 结束有关在大型动物中,西班牙人喜欢在竞技场中杀人。 - WW又名阿提拉Incomplete types *cannot* be passed by value. Sorry, but you talk B/S here.And that B/S is *not* Bjarne Stroustrup, but has something to do with theend of the digestion process in big animals Spanish like to kill in arenas.--WW aka Attila 这篇关于GCC和枚举的前向声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-14 06:01