Chinaunix
标题:
什么C++方言允许不用keyword声明int变量
[打印本页]
作者:
lipingtababa
时间:
2008-10-31 12:40
标题:
什么C++方言允许不用keyword声明int变量
我前两天想找一个二进制文件编辑器,google出hexed这个sf上的开源项目,觉得正适合我的需要.
我下载了源代码,按照指示编译,结果编译器抛出形如 ISO C++ forbids declaration of `stOk' with no type的错误,我看了代码,原来代码是这么写的.
我觉得这个很疯狂,但是我不敢确定它是错误的代码,因为编译器的error message也只是说ISO C++禁止这种声明.
那么请问,什么方言允许这种声明?怎么在g++里使用该方言的特性?
static const stOk = 0; // things are allright
static const stInitError = 1; // error initializing the stream
static const stReadError = 2; // error reading from the stream
static const stWriteError = 3; // error writing to the stream
static const stGetError = 4; // get found not registered class
static const stPutError = 5; // put found not registered class
static const stMemoryError = 6; // not enough memory
static const stStoreError = 7; // No Store method
static const stLoadError = 8; // No load method or error in Load
static const stCopyError = 9; // CopyFrom: error of source stream
static const stSeekError = 10; // error using Seek, GetPos etc.
static const stResetError = 11; // Could not reset stream
static const stReadTimeout = 12; // Timeout on read (CharacterStream only)
static const stWriteTimeout = 13; // Timeout on write (CharcterStream only)
[
本帖最后由 lipingtababa 于 2008-10-31 12:49 编辑
]
作者:
ynchnluiti
时间:
2008-10-31 12:52
是没有明确指定类型
static const int stOk = 0;
作者:
zixiu2008
时间:
2008-10-31 14:21
g++从2.9x开始加强了对ISO标准的符合程度,像这种没有类型声明的就直接报错了
可以加一个-fpermissive选项试试看,但某些不新不旧的g++版本可能没有这个选项,那估计就只能换个编译器了
作者:
雨过白鹭洲
时间:
2008-10-31 14:56
这个代码也够猛的
作者:
lipingtababa
时间:
2008-11-03 15:07
-fpermissive也不行,这是一坨屎代码,我已经放弃编译它了
作者:
to407
时间:
2008-11-03 17:57
赞五笔
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2