[zeromq-dev] possible bug in zframe.c ?

Peter Stirling peter at pjstirling.plus.com
Thu Jun 20 12:46:14 CEST 2013


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 <breese at mail1.stofanet.dk 
> <mailto:breese at mail1.stofanet.dk>> 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
>     zeromq-dev at lists.zeromq.org <mailto:zeromq-dev at lists.zeromq.org>
>     http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130620/6f72a0be/attachment.htm>


More information about the zeromq-dev mailing list