www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/12/23:15:39.1

From: Eugene Ageenko <ageson AT cs DOT joensuu DOT fi>
Newsgroups: comp.os.msdos.djgpp
Subject: Portability and size_t type related question
Date: Wed, 12 May 1999 16:44:10 +0300
Organization: University of Joensuu / Dept. of Computer Sci.
Lines: 45
Message-ID: <373985AA.EF8D47D5@cs.joensuu.fi>
NNTP-Posting-Host: cspc52.joensuu.fi
Mime-Version: 1.0
X-Mailer: Mozilla 4.51 [en] (Win95; I)
X-Accept-Language: ru
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi back again!

I was very glad to get esterday DJGPP 2.02 and find that the bugs I
was aware were fixed. Well done. 

But now, apparetnly, I have some questions, maybe you will consider
too stupied, but since I am stucked, maybe you could help me.

The questions are about portability C and merely implies DJGPP, since
it is the compiler I am using (actually I am quite pleased with it :-)
and the code it generates:

Q1. Is there any way in C to specify the integer type for variable and
to
be sure that this type is exactly 4 bytes long. Like 'char' is always
1 byte.

It is because 'int' is depending on the system, and I have to be sure
I am writing/reading 4 bytes (ot let's say the SAME amount of bytes
to/from file). This is for portability.

Q2. More complicated question: the type 'size_t'. this type is
required for
operations with memory and read/write functions. What about this
type?  

Is it the standard type, which is always 4 byte long, or what?

I could not locate any description of it.

What I know is that it is defined in a different way in DJGPP
(unsigned long int) and GCC (on UNIX at least): as unsigned int.

It does matter, since implies the difference in casting, and formatted
output.
And, I see that all software libraries tend to define its own size_t.
(like ZLIB or PNG libraries)

Actually I wish to use some type which is of the constant length and
wanna
be sure it will be portable.

Can you help me with this?  

Eugene

- Raw text -


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