const with pointers reads from right-to-left, (though you can put the
const on either side of the base type, I always put it to the left for
consistency)
char const * const x; // read should be read as "x is a constant pointer
to a constant char"
On 20/06/13 06:28, asif saeed wrote:
@Bjorn
1st two are correct and mean the same thing except that the 1st one
may create some issues when used with typedefs.
The 3rd one is wrong - it should be " const char *const x ==> x is a
constant pointer to constant character".
Best regards,
-Asif
PS: The comment is based on my understanding of C++. AFAIK, C treats
consts the same as C++.
On Tue, Jun 18, 2013 at 6:48 PM, Bjorn Reese <[email protected]
<mailto:[email protected]>> wrote:
On 06/18/2013 03:34 PM, Pieter Hintjens wrote:
> "const char *x" => "x is a pointer to characters which are constant"
> "char const *x" => "x is a pointer that is constant, to characters
> (which may be changed)"
> "const char const *x" => "x is a pointer to constant characters
and is
> itself constant"
Only the first is correct. See:
http://c-faq.com/ansi/constptrconst.html
http://www.parashift.com/c%2B%2B-faq-lite/const-ptr-vs-ptr-const.html
_______________________________________________
zeromq-dev mailing list
[email protected] <mailto:[email protected]>
http://lists.zeromq.org/mailman/listinfo/zeromq-dev
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev