由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - Is there anything wrong with this C++ array initialization?
相关主题
Memory Usage问题140的状态直接成了Acceptance,是好消息还是坏消息?
invalid opcode什么情况?
excel macro running slowTSC EB1-A DIY I140 approved timeline&装订
A dummy question on using VM一个员工到底值多钱 (转载)
Node.js question: webpage always defaults to index.html【万能船版】我的电脑
paypal被limited了无解,ebay还活着,下一步怎么做?面试的一些题目
EB-1B PP一般收到以后多久出现PP clock start?Help: BOOTMGR is missing (Vista Home Premium on Thinkpad T400)
相关话题的讨论汇总
话题: nbins话题: c++话题: line话题: array
进入Programming版参与讨论
1 (共1页)
g****g
发帖数: 1828
1
const int nbins = 13;
double xbin[nbins+1];
for (int i=0;i xbin[i]= 10.0*i;
here's the message, but the line number is incorrect; it's far from the line
where this array is located.
Limitation: Statement too long FILE:drawRatios4.C LINE:96
cint: Security mode 0x7:0x2 *** Fatal error in interpreter... restarting
interpreter ***
*** Fatal error in interpreter... restarting interpreter ***
t****t
发帖数: 6806
2
no this code snipet is correct.
is this line 96? if not, why don't you show line 96?

line

【在 g****g 的大作中提到】
: const int nbins = 13;
: double xbin[nbins+1];
: for (int i=0;i: xbin[i]= 10.0*i;
: here's the message, but the line number is incorrect; it's far from the line
: where this array is located.
: Limitation: Statement too long FILE:drawRatios4.C LINE:96
: cint: Security mode 0x7:0x2 *** Fatal error in interpreter... restarting
: interpreter ***
: *** Fatal error in interpreter... restarting interpreter ***

N***m
发帖数: 4460
3
this part is correct

line

【在 g****g 的大作中提到】
: const int nbins = 13;
: double xbin[nbins+1];
: for (int i=0;i: xbin[i]= 10.0*i;
: here's the message, but the line number is incorrect; it's far from the line
: where this array is located.
: Limitation: Statement too long FILE:drawRatios4.C LINE:96
: cint: Security mode 0x7:0x2 *** Fatal error in interpreter... restarting
: interpreter ***
: *** Fatal error in interpreter... restarting interpreter ***

g****g
发帖数: 1828
4
多谢大家! 我找到了错误的原因。忘了说,上面那段code原来全在global variable的
部分。
我这样做就没问题了,把他们放在不同的地方:
//这部分仍然放在global
const int nbins = 13;
//这部分转移到第一个被调用的function的最前面部分。
//(其实任何用到该array前都可以,我觉得。但放在开头清楚些。)
double xbin[nbins+1];
for (int i=0;i xbin[i]= 10.0*i;
1 (共1页)
进入Programming版参与讨论
相关主题
Memory Usage问题140的状态直接成了Acceptance,是好消息还是坏消息?
invalid opcode什么情况?
excel macro running slowTSC EB1-A DIY I140 approved timeline&装订
A dummy question on using VM一个员工到底值多钱 (转载)
Node.js question: webpage always defaults to index.html【万能船版】我的电脑
paypal被limited了无解,ebay还活着,下一步怎么做?面试的一些题目
EB-1B PP一般收到以后多久出现PP clock start?Help: BOOTMGR is missing (Vista Home Premium on Thinkpad T400)
相关话题的讨论汇总
话题: nbins话题: c++话题: line话题: array