---
title: "C++指针释疑"
author: "mmdev"
date: "2004-08-07T09:34:00Z"
tags: []
slug: "c"
draft: false
lastmod: "2004-08-07T09:34:00Z"
id: 1006699
url: "https://mmdev.iteye.com/blog/1006699"
---

来源：&lt;The C++ Programming Language&lt;the language="" programming c&gt;&gt;&lt;/the&gt;

void f(int* pi)  
{  
void* pv = pi; // ok: implicit conversion  
\*pv; // error: can't dereference void*  
pv++; // error: the size of the object pointed to is unknown  
int* pi2 = static\_cast&lt;int\*&gt;(pv); // explicit conversion back to int*  
double* pd1 = pv; // error  
double* pd2 = pi; // error  
double* pd3 = static\_cast&lt;double\*&gt;(pv); // ok but unsafe  
}