www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/18/09:00:50

From: "Alexei A. Frounze" <alex DOT fru AT mtu-net DOT ru>
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: <Pine DOT SUN DOT 3 DOT 91 DOT 1000517145742 DOT 626A-100000 AT is> <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
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" <alex DOT fru AT mtu-net DOT ru> 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/


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019