Borland C++ 5.02 IDE 中的 bug (转)

Borland C++ 5.02 IDE 中的 bug (转)[@more@]

Borland C++ 5.02 ide 中的一个 bug

from http://coneos.126.com

DarkSpy在Borland C++新闻组看到关于Borland C++ 5.02 IDE中的一个bug。

这个bug将会让编译器产生出错信息“(1,1) Bad object file record in module xxx near module offset 0x........”。
DarkSpy也试验了一下,确实是一个问题。

如果有Borland C++的fans的话,也不妨试验一下,具体步骤如下。

建立一个工程,目标程序为MS-DOS程序,工程名字就叫tm_terror,

然后,建立一个头文件:terror.h,里面写上代码:
#ifndef terr_h
#define terr_h

namespace foo
{
template
inline T absolute(T number)
{
if(number < T(0) ) return -number;
return number;
}
}

#endif

然后,建立:terror.cpp,写上代码:
#include "terror.h"

namespace foo2
{
using foo::absolute;

int do_test(int i)
{ return absolute(i); }
}

然后,在工程文件:tm_terror.cpp中,写上代码:
namespace foo2
{ int do_test(int); /* to spare a header, declaration */ }

int main()
{
return foo2::do_test(0);
}

注意,工程中,terror.cpp必须要在tm_terror.cpp上面,不是的话则用alt+up键提上去。

然后,编译,你就会发现这个错误显示。:)

如何解决?

1) 在 template 中不要使用 "using namespace::name;" ,要用 "using namespace;";
2) 在 IDE 中关闭 "Generate debug information" 选项。

虽然如此,Borland C++ 5.02 仍然不失为一款强劲的编译器,DarkSpy一直使用的就是这个。:)

DarkSpy 2001/6/3


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10752043/viewspace-990129/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10752043/viewspace-990129/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值