LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 913|回复: 1

请教: 二级指针转换为一级指针?

[复制链接]
发表于 2010-8-12 13:29:19 | 显示全部楼层 |阅读模式
先看代码:

  1. [color="Blue"]typedef void *SMIQ;[/color]
  2. bool smi_receive_getaddr( SMIQ *sqp, void **addr);

  3. struct my_msg *msg;
  4. ...
  5. smi_rcceive_getaddr(sqp, (void **)&msg);

  6. typedef struct {
  7.         ...
  8. } SMIQ_FIFO;

  9. bool smi_close_fifo(SMIQ *sqp)
  10. {
  11.       [color="Blue"]  SMIQ_FIFO *p = (SMIQ_FIFO *)sqp;    //二级指针转换为一级指针?[/color]
  12. ...
  13. }
复制代码


为什么要把二级指针转换为一级指针呢?
有什么特殊的用途?
发表于 2010-8-12 14:54:07 | 显示全部楼层
看不出什么特殊用途,UNIX源代码里有的地方还拿void *当int用
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表