Const sucks

Bobba Fett sucks at notmymail.com
Mon Sep 10 16:55:33 PDT 2007


Janice Caron Wrote:

> On 9/10/07, Alexander Panek <a.panek at brainsware.org> wrote:
> > What exactly is the is the difference between head and tail const?
> 
> Suppose you have a pointer to pointer to pointer to pointer to pointer to int.
> (The length of this chain is irrelevant. I just threw lots in for the
> hell of it).
> 
> Head const would be
> const pointer to pointer to pointer to pointer to pointer to int.
> 
> Tail const would be
> pointer to const pointer to const pointer to const pointer to const
> pointer to const int.
> 
This highlights another source of confusion for me.  I assumed tail const
would be 

pointer to pointer to pointer .... to const int.

What you have described I would call "rest const" using naive intuition.

> Total const would be
> const pointer to const pointer to const pointer to const pointer to
> const pointer to const int.
> 
> i.e. head const and tail const both at the same time.




More information about the Digitalmars-d mailing list