总线错误,调整大小矢量 [英] bus error, resize vector

查看:75
本文介绍了总线错误,调整大小矢量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我调整矢量大小时,我得到一个总线(或者它是buss)错误


typedef std :: vector< doubledblvec;

n = 127;

dblvec rv;

rv.resize(n); //错误发生在这里


任何线索?如果需要,我可以发布更多信息吗?

I get a bus (or is it buss) error when I resize a vector

typedef std::vector<doubledblvec;
n = 127;
dblvec rv;
rv.resize(n); // error happens here

Any clues ? I can post more info if required ?

推荐答案

im ***** @ hotmail.co.uk 写道:
im*****@hotmail.co.uk wrote:

我得到一个总线(或者它是buss)时出错我调整了一个矢量大小


typedef std :: vector< doubledblvec;

n = 127;

dblvec rv;

rv.resize(n); //错误发生在这里


任何线索?如果需要,我可以发布更多信息?
I get a bus (or is it buss) error when I resize a vector

typedef std::vector<doubledblvec;
n = 127;
dblvec rv;
rv.resize(n); // error happens here

Any clues ? I can post more info if required ?



以下代码完美无瑕。尝试发布实际上产生错误的代码




#include< vector>


int main ()

{

typedef std :: vector< doubledblvec;

int n = 127;

dblvec rv ;

rv.resize(n); //错误发生在这里

}


-

有两件事情是不容置疑的,逻辑和感知。

怀疑那些,你不再*有任何人讨论你的怀疑,

或任何讨论它们的能力。

The below code works perfectly. Try posting the code that actually
produced the error.

#include <vector>

int main()
{
typedef std::vector<doubledblvec;
int n = 127;
dblvec rv;
rv.resize(n); // error happens here
}

--
There are two things that simply cannot be doubted, logic and perception.
Doubt those, and you no longer*have anyone to discuss your doubts with,
nor any ability to discuss them.



Daniel T.写道:

Daniel T. wrote:

以下代码完美无缺。尝试发布实际上产生错误的代码。
The below code works perfectly. Try posting the code that actually
produced the error.



的确如此。我怎么能这样做,整个事情太大而无法发布,但

为什么它是相关的。正如我所说,我可以发布更多但为什么?


DEBUG_LOG(" fn1");

rv.resize(n); //错误发生在这里

DEBUG_LOG(" fn2");


我知道错误发生在rv.resize(n)因为我不'从第二个DEBUG_LOG获得输出



Indeed. How can I do that the whole thing is too large to post, but
why is it relevant. As I said I can post more but why ?

DEBUG_LOG("fn1");
rv.resize(n); // error happens here
DEBUG_LOG("fn2");

I know the error happens at rv.resize(n) because I don''t get the output
from the second DEBUG_LOG.


2006年9月29日11:36:55 -0700, im ***** @ hotmail.co.uk 写道:
On 29 Sep 2006 11:36:55 -0700, im*****@hotmail.co.uk wrote:

> Daniel T.写道:
>Daniel T. wrote:

>以下代码完美无瑕。尝试发布实际产生错误的代码。
>The below code works perfectly. Try posting the code that actually
produced the error.


的确如此。我怎么能这样做,整个事情太大而无法发布,但
为什么它是相关的。正如我所说,我可以发布更多但为什么?

DEBUG_LOG(" fn1");
rv.resize(n); //错误发生在这里
DEBUG_LOG(" fn2");

我知道错误发生在rv.resize(n)因为我没有得到输出
来自第二个DEBUG_LOG。


Indeed. How can I do that the whole thing is too large to post, but
why is it relevant. As I said I can post more but why ?

DEBUG_LOG("fn1");
rv.resize(n); // error happens here
DEBUG_LOG("fn2");

I know the error happens at rv.resize(n) because I don''t get the output
from the second DEBUG_LOG.



总线错误通常源于未对齐的对象,而不是来自您发布的代码

。您是否使用自定义内存分配器?

A bus error usually stems from misaligned objects, not from the code
you posted. Do you use a custom memory allocator?


这篇关于总线错误,调整大小矢量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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