From: Damian Yerrick Newsgroups: comp.os.msdos.djgpp Subject: Re: C++, complex, etc Organization: Pin Eight Software http://pineight.8m.com/ Message-ID: References: <3923BA11 DOT AD387617 AT mtu-net DOT ru> <8g15d8$nl9$1 AT news01 DOT cit DOT cornell DOT edu> <39242D85 DOT 6A95D430 AT mtu-net DOT ru> <8g23d1$6qp$1 AT news01 DOT cit DOT cornell DOT edu> <3924E744 DOT 748FFFEC AT mtu-net DOT ru> X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 27 X-Trace: /K49oE1N+kChZz+4MG5Cqrky9WBzi9DPMd1NeEm/eGXf/7RyDJBJwYbZhtLBFRJkoQqgXAt3utIn!qoBX1PzSGPJOSuAKwaT382O0At5DXTWMHuW8WsLYYHqZmds9wbNRFGriwX2NgRs5I8Ty2HgH4l2+!UuVHQ3Y= X-Complaints-To: abuse AT gte DOT net X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly NNTP-Posting-Date: Mon, 22 May 2000 02:47:00 GMT Distribution: world Date: Mon, 22 May 2000 02:47:00 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Fri, 19 May 2000 11:03:32 +0400, "Alexei A. Frounze" wrote: >"A. Sinan Unur" wrote: >> the problem with casting an object of type size_t to int is the same as the >> problem with casting an unsigned int to char. sure enough there may be >> platforms where you don't loose any information in the process, but it is >> not safe. what if size_t is 64 bits and int is 32 bits? casting how can >> casting size_t to int be safe (even disregarding the sign issue, which is >> bad enough). > >Suppose we have a string. If the string is definetely shorter than INT_MAX >and SSIZE_MAX (say less than 32000 characters), there must be everything >okay with type casting for strlen(), strncpy(), etc. But if your string contains the full text of Carlo Collodi's _The Adventures of Pinocchio_ (loaded from the Project Gutenberg etext), and you're on a 16-bit system, things start to break down. Can you say "buffer overflow"? -- Damian Yerrick "I refuse to listen to those who refuse to listen to reason." See the whole sig: http://www.rose-hulman.edu/~yerricde/sig.html This is McAfee VirusScan. Add these two lines to your signature to prevent the spread of signature viruses. http://www.mcafee.com/