16 Jul
2007
16 Jul
'07
1:26 p.m.
On 16-07-2007 15:22:27 +0200, Sjoerd Mullender wrote:
This is actually pretty useless. You've declared val as a const, not what val point to (i.e. the chars that make up the string). Consider this:
typedef char *str; void foo(const str x) { *x = 0; }
this is valid code and will be accepted by both gcc and icc, but this is exactly what you try to prevent from happening when you declare a parameter const char *. In other words, val should be declared as const char *val, and then you shouldn't need the case when calling the function.
s/case/cast/
I didn't realise a typedef is really something different for the compiler. Thanks for the info. I reverted my check-in and solved it via an intermediate buffer.