On Wed, 2014-12-03 at 15:37 +0000, Jose Fonseca wrote:
> From: José Fonseca <[email protected]>
> 
> When in C++ mode, MSVC defines overloaded versions of standard names
> that preserve constness. :-/
> 
> http://msdn.microsoft.com/en-us/library/b34ccac3.aspx
> ---
>  tests/util/piglit-util.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
> index 099075a..af9fb97 100755
> --- a/tests/util/piglit-util.h
> +++ b/tests/util/piglit-util.h
> @@ -211,7 +211,11 @@ strtod_inf(const char *nptr, char **endptr)
>  static inline char *
>  strchrnul(const char *s, int c)
>  {
> +#if defined(_MSC_VER) && defined(__cplusplus)
> +     char *t = strchr((char *)s, c);

shouldn't the above version work in all cases? Implicit conversion to
const should be ok with other compilers, or am I missing something?

jan

> +#else
>       char *t = strchr(s, c);
> +#endif
>  
>       return (t == NULL) ? ((char *) s + strlen(s)) : t;
>  }

-- 
Jan Vesely <[email protected]>

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to