What is the difference between...
Janice Caron
caron at serenityfirefly.com
Fri Sep 7 04:10:39 PDT 2007
OK. Not quite what I was getting at, but still useful, thanks.
In that case, what is the difference between:
int f(const void * p, int len)
and
int f(const(void *) p, int len)
?
Put another way: what's the difference between "const (...)" with brackets and
"const ..." without? What happens when you take the brackets away? What is the
difference between const as a parameter storage class, and const as a type
modifier?
The following really does compile without error:
void f(const const(int) p)
and I don't understand what the two different versions of "const" are each
doing.
-----Original Message-----
From: digitalmars-d-bounces at puremagic.com
[mailto:digitalmars-d-bounces at puremagic.com] On Behalf Of Xinok
Sent: 07 September 2007 11:08
To: digitalmars-d at puremagic.com
Subject: Re: What is the difference between...
> const void*
> This can also be read as:
> const(void*)
> This means that both 'void' and the pointer are const.
>
> const(void)*
> The pointer is mutable, but the data it points to must be const, even though
> it doesn't know the type of the data.
>
> Janice Caron wrote:
> > What is the difference between:
> >
> > int f(const void * p, int len)
> >
> > and
> >
> > int f(const(void)* p, int len)
> >
> > ?
More information about the Digitalmars-d
mailing list