🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4723

size_t

#4723
From: Steve Clamage
Date: Mon, 29 Jan 1996 16:57
26 lines
1595 bytes
I have always thought that type size_t must be defined as one of
the standard unsigned integer types: unsigned [char | short | int | long].
I don't find wording in the ISO standard requiring that, however.
Sections 7.1.6 and 6.3.4 say it is an "unsigned integral type", a term
I don't find defined. "Integer type" is defined, but not "integral type".

Example: A system has a 48-bit address space and 48-bit pointers, but does
not have a 48-bit integer type. (The integer types are 8, 16, 32, and
maybe 64 bits.) Suppose the implementation predefined an unsigned 48-bit
type "__ptrsize", and size_t was typedef'd to be __ptrsize.

Is such an implementation intentionally allowed, accidently allowed, or
not allowed by the Standard?

That is, the only question in my mind is whether size_t can be a type
different from ALL of the standard types. I believe all the other
characteristics of my hypothetical implementation are valid.

If it makes a difference, suppose that the standard headers (<stddef.h>, etc)
are not readable by programmers, and the existence of type __ptrsize is
not documented and is thus unknown to users of the implementation. All
they can observe is that
	sizeof(size_t) != sizeof(any_other_type)
---
Steve Clamage, stephen.clamage@eng.sun.com
Technical Details
Message-ID: <4eiua2$9u@engnews1.Eng.Sun.COM>
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!usenet

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!usenet
From: clamage@Eng.Sun.COM (Steve Clamage)
Newsgroups: comp.std.c
Subject: size_t
Date: 29 Jan 1996 16:57:38 GMT
Organization: Sun Microsystems Inc.
Message-ID: <4eiua2$9u@engnews1.Eng.Sun.COM>
Reply-To: clamage@Eng.Sun.COM
NNTP-Posting-Host: 129.146.88.126