[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: casts considered harmful



> const void **
> 
> I believe it is meant to be a pointer to a pointer to a 'const void'.
> That is the data at the far destination is supposed to be the thing that
> we cannot modify, not either of the pointers we use on the way.

True.
	const X * * foo
	X const * * foo
		    foo is a 
		  pointer to a
		pointer to a
	constant X
The X's never change.  The ptrs and p'ptrs may.

	X * const * foo
		    foo is a
		  pointer to a
	    constant
	  pointer to an
	X
The X's may change.  The pointers to X's never do.  But the pointers to
the pointers might.

	X * * const foo
		    foo is a
	      constant
	    pointer to a
	  pointer to an
	X
The X's may change.  The pointer to X's may change.  But foo never does,
and it points to the pointer to an X.

Not quite sure how this relates to the overall worth of casts, though.

--
/*********************************************************************\
**
** Joe Yao				jsdy@tux.org - Joseph S. D. Yao
**
\*********************************************************************/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []