返回指针指针的类型

时间:2012-07-05 10:26:36

标签: c++ pointers gige-sdk

在GigE SDK C ++中,规范注意到GetDataPointer()的定义如下:

PvUInt8 * PvBuffer::GetDataPointer  (   )   
Get the buffer's data pointer. 
Const version.
Returns:
A pointer to the memory pointer. 

我在我的程序中使用了这个函数(pl见最后一行):

PvBuffer * lBuffer = new PvBuffer();
// Create the Data (buffers are created as images, GetImage() is valid on a fresh buffer)
lBuffer->GetImage()->Alloc( 1224, 1029, PvPixelMono8 );
PvUInt8 *lDataBuffer = lBuffer->GetDataPointer(); //use in actual code 

问题是关于PvUInt8;看看定义,这是缓冲区中数据的类型或指针的数据类型,可以是4字节(在32位机器上)或8字节(在64位机器上)。

1 个答案:

答案 0 :(得分:1)

根据提供的信息,PvUInt8似乎是unsigned char(a.k.a。“a byte”)的别名。这意味着PvUInt8 *只是一个字节指针。 sizeof(PvUInt8)应为1sizeof(PvUInt8 *)应为执行环境中指针的本机大小(例如,32位系统上的4,64位系统上的8等)