delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/19/05:15:29.1

From: dontmailme AT iname DOT com (Steamer)
Newsgroups: comp.os.msdos.djgpp
Subject: size_t
Date: Fri, 19 May 2000 09:11:46 GMT
Organization: always disorganized
Lines: 19
Message-ID: <3925053f.4246066@news.freeserve.net>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1000518184200 DOT 15189T-100000 AT is> <8g1l6o DOT 3vs4qnf DOT 0 AT buerssner-17104 DOT user DOT cis DOT dfn DOT de> <392446C8 DOT 61533B8F AT mtu-net DOT ru>
NNTP-Posting-Host: modem-40.black-angel.dialup.pol.co.uk
X-Trace: news7.svr.pol.co.uk 958727507 26865 62.136.232.40 (19 May 2000 09:11:47 GMT)
NNTP-Posting-Date: 19 May 2000 09:11:47 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Newsreader: Forte Free Agent 1.11/32.235
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Alexei A. Frounze wrote:

>> So, to answer Alexei's question: When your int is <= SIZE_MAX and >= 0,
>> you can savely assign it to a varible of size_t. If a varible of size_t
>> (or, say the return value of strlen) is <= INT_MAX, you can savely
>> assign it to a varible of type int.
>
>Stop! There are SSIZE_MAX and _POSIX_SSIZE_MAX defined only. Are those
>constants limits for size_t, right?

In fact, the C89 standard doesn't define any of SIZE_MAX, SSIZE_MAX or
_POSIX_SSIZE_MAX.  The C99 standard does define SIZE_MAX, but it will
be many years (if ever) before it's safe to assume that conforming to
the C99 standard makes a program portable.

I note that Borland C++ 5.5 defines SSIZE_MAX and _POSIX_SSIZE_MAX
as 32767, even though it's a 32-bit compiler and sizeof(size_t)==4.

S.

- Raw text -


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