Message-ID: <3923FEC5.B836D26B@mtu-net.ru> Date: Thu, 18 May 2000 18:31:33 +0400 From: "Alexei A. Frounze" X-Mailer: Mozilla 4.72 [en] (Win95; I) X-Accept-Language: ru,en MIME-Version: 1.0 To: Eli Zaretskii Cc: djgpp AT delorie DOT com Subject: Re: C++, complex, etc References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Recipient: eliz AT is DOT elta DOT co DOT il Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote: > > On Thu, 18 May 2000, Alexei A. Frounze wrote: > > > 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? > > In general, you don't want to assign int to size_t or vice versa. Mixing > signed and unsigned means trouble. If I'm 100% sure my "int" is positive (greater or equal 0 and less than INT_MAX), will I have problems? > If you pass an int to a function that expects size_t, and the prototype > is visible to the compiler, the compiler will do the casting for you, but > it is up to you to make sure this works. For example, passing a negative > value to a function that expects a size_t argument is usually not a good > idea ;-). > > > OK, if it's so important, how many bugs are caused by not caring about > > size_t? > > Plenty. That's why the feature of GCC whereby it warns about comparing > signed and unsigned is so important. Again, if I have "int" in the 0...INT_MAX range, do I have those problems? > > I don't mean in my own programs. Let's say in M$'... > > I have never looked at any of Microsoft's sources. Never mind. They have a lot of trouble with other things. :) -- Alexei A. Frounze ----------------------------------------- Homepage: http://alexfru.chat.ru Mirror: http://members.xoom.com/alexfru