指向不透明对象的指针大小 [英] Size of pointer to opaque object

查看:81
本文介绍了指向不透明对象的指针大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

``表示对象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

推荐答案

" Ellarco" <无**** @ eircom.net>写道...
"Ellarco" <no****@eircom.net> wrote...
``表示对象ID的不透明指针。
struct _objID;
typedef struct _objID * objectID;''''
<再次嗨。我使用定义了objectID类型的api。上面的
表示文档的大小。

上面的意思是objectID被定义为一个指向尚未定义的
未定义的类/结构_objID的指针,如果我理解这个术语,那么_bjID类/结构的实际性质尚未知,是不透明的
,是吗?

我的问题是我需要静态确定objectID的大小。
我现在需要占用与1,2,3 ... chars,
相同的空间,但不使用sizeof(objectID)。可能吗?我以为
可能与char *的大小相同或类似的东西。
``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.




指向任何对象的指针的大小是相同的并且与

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


Ellarco写道:

....
Ellarco wrote:
....
我的问题是我需要静态地确定objectID的大小。我现在需要占用与1,2,3 ...字符相同的空间,但不使用sizeof(objectID)。可能吗?我当时认为它可能和char *一样大小或类似的东西。
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.




什么阻止你使用sizeof(objectID)?



What is stopping you from using sizeof(objectID) ?




Victor Bazarov写道:

[...]

Victor Bazarov wrote:
[...]
我的问题是我需要静态地确定objectID的大小。我现在需要占用与1,2,3 ...字符相同的空间,但不使用sizeof(objectID)。可能吗?


是的。使用sizeof(_objID *)。

我当时认为它可能与char *的大小相同或类似的方便。
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?
Yes. Use sizeof(_objID *).
I was thinking that it might
be the same size as char* or something convenient like that.



指向任何对象的指针的大小是相同的,并且与指向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.


这篇关于指向不透明对象的指针大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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