www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/19/06:34:29

Message-ID: <374293B3.2DDB1749@cs.joensuu.fi>
Date: Wed, 19 May 1999 13:34:28 +0300
From: Eugene Ageenko <ageson AT cs DOT joensuu DOT fi>
X-Mailer: Mozilla 4.51 [en] (Win95; I)
X-Accept-Language: ru
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp,gnu.gcc.help,gnu.gcc
To: djgpp AT delorie DOT com
Subject: Re: Portability and size_t type related question - AGAIN
References: <Pine DOT SOL DOT 4 DOT 10 DOT 9905131626430 DOT 17043-100000 AT cs DOT joensuu DOT fi>
Reply-To: djgpp AT delorie DOT com

> The second point I had for Eugene is that we already solved his
> original problem long ago as he proposed the above solution to
> be added our library. Our solution, as you might have guess,
> uses any type, not EXACTLY 2 bytes, but AT LEAST two bytes,
> and then use routines such as:
> 
>   WriteIntegerToFile(file,value,bytes)
>   ReadIntegerFromFile(file,*value,bytes)
> 
> This inputs/outputs the integer byte by byte, using the number
> of bytes given the last parameter.

But now nobody can get to COMMON decision what type should have
variable value in above definition.

I had required it to be unsigned long, to accept either short int,
int, and long int.
Other words all family of int (and we do nto work with negative
numbers)

But our programmers do mind about it. One said that int is better
because the problems of pointer conversion in ReadIntegerFromFile will
arise. 

(Formerly we had following function, which is not supported errors)

int ReadIntegerFromFile (file, bytes)

And it was proposed to change it to the above quoted definition.

I have proposed to use following code to avoid problems (supposed
that: int x;)

> > > > > usinged long y;
> > > > > if (ReadIntegerFromFile(f,&y,bytes)!=bytes) Exit_me();
> > > > > x = y;

Could you advise me now, which type should be *value in the
ReadIntegerFromFile functions as above?

I need compatibility with 16-bit systems and ANSI (so please do not
propose me long long int definition)

Eugene

- Raw text -


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