【发布时间】:2012-02-24 18:11:59
【问题描述】:
使用 -fdump-tree-gimple 选项 (GCC 4.6.1) 编译 C++ 时,我得到的代码中包含以下函数:
std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = int, _Alloc = std::allocator<int>] (struct _Vector_base * const this)
{
int * D.8482;
long int D.8483;
int * D.8484;
long int D.8485;
long int D.8486;
long int D.8487;
long unsigned int D.8488;
int * D.8489;
struct _Vector_impl * D.8490;
{
try
{
D.8482 = this->_M_impl._M_end_of_storage;
D.8483 = (long int) D.8482;
D.8484 = this->_M_impl._M_start;
D.8485 = (long int) D.8484;
D.8486 = D.8483 - D.8485;
D.8487 = D.8486 /[ex] 4;
D.8488 = (long unsigned int) D.8487;
D.8489 = this->_M_impl._M_start;
std::_Vector_base<int, std::allocator<int> >::_M_deallocate(this, D.8489, D.8488);
}
finally
{
D.8490 = &this->_M_impl;
std::_Vector_base<int, std::allocator<int>::_Vector_impl::~_Vector_impl (D.8490);
}
}
<D.8393>:
}
您可以通过编写一个使用std::vector<int> 的简单程序来获取此代码。无论如何,我不明白的代码部分是D.8487 = D.8486 /[ex] 4;。我查看了/usr/include/c++/4.6.1/std_vector.h 的源代码,它的析构函数是一个调用_M_deallocate 的单行代码。有谁知道运算符/[ex] 代表什么?到目前为止,我唯一注意到的是 RHS 操作数是向量参数化的类型的大小。
【问题讨论】:
-
不会将此作为答案发布,因为我没有支持文档,但我认为它有两个单独的标记
/和[ex],第一个是除法,第二个是扩展运算符4表示与分子相同的类型。