From: "Alexei A. Frounze" Newsgroups: comp.os.msdos.djgpp Subject: Re: C++, complex, etc Date: Thu, 18 May 2000 13:54:41 +0400 Organization: MTU-Intel ISP Lines: 51 Message-ID: <3923BDE1.737AEF47@mtu-net.ru> References: <3922DA9E DOT 8DF00783 AT mtu-net DOT ru> <392311DE DOT 3700368D AT bigfoot DOT com> <39236A55 DOT 78749ABD AT mtu-net DOT ru> <8g0688$cdm$1 AT news01 DOT cit DOT cornell DOT edu> NNTP-Posting-Host: ppp108-214.dialup.mtu-net.ru Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit X-Trace: gavrilo.mtu.ru 958643715 53129 212.188.108.214 (18 May 2000 09:55:15 GMT) X-Complaints-To: usenet-abuse AT mtu DOT ru NNTP-Posting-Date: 18 May 2000 09:55:15 GMT X-Mailer: Mozilla 4.72 [en] (Win95; I) X-Accept-Language: ru,en To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Does that mean I need to put (int) and (size_t), if I want to assign a value of int to size_t and vice virsa? OK, if it's so important, how many bugs are caused by not caring about size_t? I don't mean in my own programs. Let's say in M$'... bye. Alexei A. Frounze ----------------------------------------- Homepage: http://alexfru.chat.ru Mirror: http://members.xoom.com/alexfru "A. Sinan Unur" wrote: > > > > > Eli Zaretskii wrote: > > > > > You need it for portability. > > > > > > > > > > size_t is not equal to int. Its precise definition depends on > > > > > the implementation. > ... > > > > > You seem to be missing the point that you shouldn't rely on > > > > > size_t and int being the same size (also: size_t is unsigned, > > > > > ssize_t is signed). > > "Alexei A. Frounze" wrote in message > news:39236A55 DOT 78749ABD AT mtu-net DOT ru... > > > I've never said I _rely_. I don't use size_t in my sources. Only > > standard types: char, short, int, long int, long long,... ;) > > i am sorry but this statement makes no sense. size_t is no less standard > than int, but afaik long long is not in the standard at all. > > eli's warning is extremely appropriate: size_t has a well defined meaning > that "it is the safest type that can represent the size of the largest data > object you can create" (P.J. Plauger's "The Standard C Library", p.219.) > > for example, the following code is not safe > > int main(int argc, char *argv[]) { > unsigned len = strlen(argv[0]); > } > > because unsigned int is not guaranteed to be able to hold a size_t even > though it may seem to work for now. > > -- > mailto:Sinan_Unur AT mail DOT com > http://unur.com/