delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/18/15:20:10

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 21:51:01 +0400
Organization: MTU-Intel ISP
Lines: 62
Message-ID: <39242D85.6A95D430@mtu-net.ru>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1000518113101 DOT 12245I-100000 AT is> <3923BA11 DOT AD387617 AT mtu-net DOT ru> <8g15d8$nl9$1 AT news01 DOT cit DOT cornell DOT edu>
NNTP-Posting-Host: ppp104-235.dialup.mtu-net.ru
Mime-Version: 1.0
X-Trace: gavrilo.mtu.ru 958672931 87808 212.188.104.235 (18 May 2000 18:02:11 GMT)
X-Complaints-To: usenet-abuse AT mtu DOT ru
NNTP-Posting-Date: 18 May 2000 18:02:11 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

"A. Sinan Unur" wrote:
> 
> "Alexei A. Frounze" <alex DOT fru AT mtu-net DOT ru> wrote in message
> news:3923BA11 DOT AD387617 AT mtu-net DOT ru...
> > Eli Zaretskii wrote:
> > >
> > > On Thu, 18 May 2000, Alexei A. Frounze wrote:
> > >
> > > > I don't use size_t in my sources.
> > >
> > > You cannot do that if those sources call standard functions which
> > > accept or return size_t values, such as strlen, memcpy, malloc,
> > > etc.  If you use int instead of size_t in these cases, your code
> > > becomes non-portable.
> >
> > Really? How about type casting? It doesn't work at all for int<->size_t?
> 
> are you seriously asking this or is this just a troll?

Well, let it be "unsigned int" <-> "size_t".

> what do you expect the following code to produce:
> 
> #include <stdio.h>
> 
> int main(void) {
>     char c;
>     unsigned int i2;
>     unsigned int i1 = 0x12345678;
> 
>     c = (char) i1;

i1 exceeds valid range. Actually I mean values that can be represented by
both "<unsigned>int" and "size_t".

>     i2 = (unsigned int) c;

Don't overact.

> 
>     printf("i1: %8.8x\tc: %2.2x\ti2: %8.8x\n", i1, c, i2);
> 
>     return 0;
> }
> 
> do you think i1 == i2?

Am I that stupid???

> 
> Sinan.
> --
> mailto:Sinan_Unur AT mail DOT com
> http://unur.com/

-- 
Alexei A. Frounze
-----------------------------------------
Homepage: http://alexfru.chat.ru
Mirror:   http://members.xoom.com/alexfru


- Raw text -


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