问题描述
``表示对象ID的不透明指针。
struct _objID;
typedef struct _objID * objectID;''''
你好。我使用定义了objectID类型的api。上面的
表示文档上的
范围。
以上意味着objectID被定义为指向尚未定义
class / struct _objID,并且,如果我理解正确的术语,则
是不透明的,只要_objID类/结构的实际性质是还不知道,
是啊?
我的问题是我需要静态地确定objectID的大小。我现在需要
占用与1,2,3 ...字符相同的空间,但不使用sizeof(objectID)
。可能吗?我当时认为它可能会像char *一样大小或类似的东西。
TIA
``Opaque-pointer representing the ID of an object.
struct _objID;
typedef struct _objID * objectID;''''
Hi again. Im using an api that defines an objectID type. The above
represents the
extent of the documentation on it.
The above means that objectID is defined as a pointer to an as yet undefined
class/struct _objID, and, if I understand the term correctly, is opaque in
so far as the actual nature of the _objID class/struct is as yet unknown,
yeah?
My problem is that I need to statically determine the size of an objectID. I
need to now that it occupies the same amount of space as 1,2,3... chars, but
without using sizeof(objectID). Is it possible? I was thinking that it might
be the same size as char* or something convenient like that.
TIA
推荐答案
指向任何对象的指针的大小是相同的并且与
a指向void相同。因此,您可以将sizeof(void *)用于您的目的。
Victor
The size of a pointer to any object is the same and is the same as
a pointer to void. So, you may use sizeof(void*) for your purposes.
Victor
什么阻止你使用sizeof(objectID)?
What is stopping you from using sizeof(objectID) ?
指向任何对象的指针的大小是相同的,并且与指向void的指针相同。
The size of a pointer to any object is the same and is the same as
a pointer to void.
更改诊所,Bazarov。
问候,
亚历山大。
Change the clinic, Bazarov.
regards,
alexander.
这篇关于指向不透明对象的指针大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!