15 messages in ru.sysoev.nginxRe: Why u_char* not char*
FromSent OnAttachments
Ilan BerknerJul 14, 2009 11:13 am 
Michael ShadleJul 14, 2009 12:57 pm 
Ilan BerknerJul 14, 2009 1:06 pm 
Maxim DouninJul 14, 2009 1:16 pm 
Michael ShadleJul 14, 2009 1:19 pm 
Ilan BerknerJul 14, 2009 1:24 pm 
Michael ShadleJul 14, 2009 1:24 pm 
Ilan BerknerJul 14, 2009 1:32 pm 
Marcus ClyneJul 14, 2009 1:56 pm 
merlin coreyJul 14, 2009 2:40 pm 
Marcus ClyneJul 14, 2009 3:02 pm 
Maxim DouninJul 14, 2009 6:40 pm 
Igor SysoevJul 15, 2009 12:05 am 
Marcus ClyneJul 15, 2009 3:12 am 
merlin coreyJul 15, 2009 4:56 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: Why u_char* not char*Actions...
From:Marcus Clyne (macc@gmail.com)
Date:Jul 14, 2009 3:02:25 pm
List:ru.sysoev.nginx

Hi,

merlin corey wrote:

What's the difference in storage of these types in memory?

AFAIK, none - u_char is just an unsigned char. I can't see why any system would store them differently and I'm guessing that type conversion would be a noop on every system (though I'd be interested to hear of any evidence otherwise).

How they are treated when representing them as numbers or when they're involved with any kind of mathematical operations would be different, though (in general).

The pain in using u_char* for strings vs char* is that you often have to deal with typecasting when interacting with other functions, reading/writing etc. It's much rarer that other functions (especially system ones) deal with u_char's rather than char's.

I was wondering why bother with the extra hassle. I'm guessing there's a reason why Igor chose them over char*'s, but I don't know what it is.

Cheers,

Marcus.