🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1228

Re: <limits.h> and MB_LEN_MAX

#1228
From: John F. Woods
Date: Fri, 28 Aug 1992 17:46
37 lines
1721 bytes
glenn@ready.com (Glenn Kasten) writes:
><limits.h> is supposed to define MB_LEN_MAX.  Is it permissible for a
>conforming implementation to define MB_LEN_MAX in terms of another
>type, where that other type is not declared in <limits.h>?  In other
>words, do header files have to be complete in themselves, or can they
>require other header files to also be included, in order to be
>usable?

"2.2.4.2.1 Sizes of Integral Types <limits.h>

    The values given below shall be replaced by constant expressions suitable
for use in #if preprocessing directives.  ...
	MB_LEN_MAX"

Including <limits.h> therefore must correctly define MB_LEN_MAX.  An
implementation that does not do so cannot compile this strictly conforming
ANSI C program:
	#include <limits.h>
	main() {
		int i = MB_LEN_MAX;
	}
and therefore is not a conforming implementation.  End of discussion.

It is acceptable for <limits.h> to perform any necessary #includes itself,
->IF<- it does so in such a way that the result of "#include <limits.h>" does
not define any identifiers other than those documented in 2.2.4.2.1 or
otherwise reserved to the implementation.

	BAD:
	<limits.h>:
	#include <screwy.h>	/* contains #define ONE 1 */
	#define MB_LEN_MAX ONE

	OK:
	<limits.h>:
	#include <screwy.h>	/* contains #define __ONE__ 1 */
	#define MB_LEN_MAX __ONE__
Technical Details
Message-ID: <15281@ksr.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!gatech!darwin.sura.net!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!eff!world!ksr!jfw
References: <1992Aug27.165044.4781@ready.eng.ready.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!gatech!darwin.sura.net!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!eff!world!ksr!jfw
From: jfw@ksr.com (John F. Woods)
Newsgroups: comp.std.c
Subject: Re: <limits.h> and MB_LEN_MAX
Message-ID: <15281@ksr.com>
Date: 28 Aug 92 13:46:34 EDT
References: <1992Aug27.165044.4781@ready.eng.ready.com>
Sender: news@ksr.com
Lines: 38