Deutsch English Français Italiano |
<vmppue$jnd7$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: James Kuyper <jameskuyper@alumni.caltech.edu> Newsgroups: comp.lang.c Subject: Re: What is __STDC_HOSTED__ ? Date: Tue, 21 Jan 2025 22:50:38 -0500 Organization: A noiseless patient Spider Lines: 41 Message-ID: <vmppue$jnd7$1@dont-email.me> References: <vmpgui$hk8l$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 22 Jan 2025 04:50:44 +0100 (CET) Injection-Info: dont-email.me; posting-host="4af44e68d4e1550a9124be2e9da8b27d"; logging-data="646567"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18uAmT5Jpzx/NBzK5zwgI5uvnTI8qTRIzY=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:s7mFslSz1rHmboRQktEqUyrf54U= Content-Language: en-US In-Reply-To: <vmpgui$hk8l$1@dont-email.me> Bytes: 3090 On 2025-01-22, Thiago Adams <thiago.adams@gmail.com> wrote: > standard says > > "__STDC_HOSTED__ The integer constant 1 if the implementation is a > hosted implementation or the > integer constant 0 if it is not." > > What is a hosted implementation? "A _strictly conforming program_ shall use only those features of the language and library specified in this document.3) It shall not produce output dependent on any unspecified, undefined, or implementation-defined behavior, and shall not exceed any minimum implementation limit." (4p5) "The two forms of _conforming implementation_ are _hosted_ and _freestanding_. A _conforming hosted implementation_ shall accept any strictly conforming program. A _conforming freestanding implementation_ shall accept any strictly conforming program in which the use of the features specified in the library clause (Clause 7) is confined to the contents of the standard headers <float.h>, <iso646.h>, <limits.h>, <stdalign.h>, <stdarg.h>, <stdbit.h>, <stdbool.h>, <stddef.h>, <stdint.h>, and <stdnoreturn.h>. Additionally, a conforming freestanding implementation shall accept any strictly conforming program where: — the features specified in the header <string.h> are used, except the following functions: strdup, strndup, strcoll, strxfrm, strerror; and/or, — the selected function memalignment from <stdlib.h> is used." (4p6) Several of the terms in those clauses are in italics, an ISO convention which indicates that the sentence in which the italicized term occurs constitutes the official definition of that term. I've indicated where the italics are by bracketing them with underscores. Thus, a conforming hosted implementation of C supports all of the mandatory features of C. A freestanding implementation of C implements the full C language, but is not required to implement all of the C standard library. It is only required to implement those parts described by the specified standard headers, and is not required to implement the specified functions from the <string.h> and <stdlib.h> headers.