#40683 [Opn->Fbk]: zend_operators.h generates discard qualifier compiler warning
| From: | tony2001@php.net | Date: | Thu, 01 Mar 2007 19:59:07 +0000 |
| Subject: | #40683 [Opn->Fbk]: zend_operators.h generates discard qualifier compiler warning | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-109768@lists.php.net to get a copy of this message | ||
ID: 40683
Updated by: tony2001@php.net
Reported By: lstefani at fortresstech dot com
-Status: Open
+Status: Feedback
Bug Type: Compile Warning
Operating System: linux 2.6.12-1.1381_FC3smp
PHP Version: 5.2.1
New Comment:
What compiler do you use?
Previous Comments:
------------------------------------------------------------------------
[2007-03-01 19:44:25] lstefani at fortresstech dot com
Description:
------------
Zend/zend_operators.h: In function `void* zend_memrchr(const void*,
int, unsigned int)':
Zend/zend_operators.h:250: warning: cast from `const void*' to
`unsigned char*' discards qualifiers from pointer target type
Zend/zend_operators.h:250: warning: cast from `const void*' to
`unsigned char*' discards qualifiers from pointer target type
In code snippet, line 250 refers to the two recasts of argument s.
Reproduce code:
---------------
static inline void *zend_memrchr(const void *s, int c, size_t n)
{
register unsigned char *e;
if (n <= 0) {
return NULL;
}
for (e = (unsigned char *)s + n - 1; e >= (unsigned char *)s; e--) {
if (*e == (unsigned char)c) {
return (void *)e;
}
}
return NULL;
}
Expected result:
----------------
No compiler warnings.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40683&edit=1