Re: Cast trap with INI entries compiling C++ extension
| From: | Andrey Hristov | Date: | Thu, 29 Sep 2011 18:11:42 +0000 |
| Subject: | Re: Cast trap with INI entries compiling C++ extension | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-55667@lists.php.net to get a copy of this message | ||
On 09/29/2011 07:13 PM, Ángel González wrote:
On 29/09/11 17:42, Olivier Favre wrote:it's easy, whatever const is closer to is immutable const char * is a pointer to a const char, because the const is closer to the char than to the pointer. char * const is a const pointer to a char, because the const is closer to the pointer than to the char. Anyway, never used char const *, which will conflict with my explanation :) Best, AndreyI checked with a tiny test program, you're right about GCC complaining. The right fix is to make the field const (I don't know about const keyword). G++ won't give warnings, no error would be triggered by a broken fix. By the way, const char* and char const* are the same, you probably meant char * const.Is it? I never remember which one is a mutable pointer of const chars and which the const pointer of mutable chars so I relied on the description at http://stackoverflow.com/questions/162480/const-in-c#answer-162504 before sending the mail.