Path: csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: "A diagram of C23 basic types" Date: Wed, 02 Apr 2025 17:41:19 -0700 Organization: None to speak of Lines: 61 Message-ID: <85ecya5b68.fsf@nosuchdomain.example.com> References: <87y0wjaysg.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Thu, 03 Apr 2025 02:41:25 +0200 (CEST) Injection-Info: dont-email.me; posting-host="658736fab9029f452335cecd036b8387"; logging-data="3377633"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+V4eJ+WPtLReOCt41BSMzz" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:lHtRe4NQZ/6M9r1PaDv+Wk+STuA= sha1:Xb8EwX1NtVbXdchGuvXFaRZfcjs= Xref: csiph.com comp.lang.c:391867 scott@slp53.sl.home (Scott Lurndal) writes: > bart writes: >>On 02/04/2025 18:29, David Brown wrote: >>> On 02/04/2025 17:38, bart wrote: [...] >>>> You also need to include some header (which one?) in order to use it. >>> >>> , as pretty much any C programmer will know. >> >>This program: >> >> void* p = NULL; >> >>reports that NULL is undefined, but that can be fixed by including any >>of stdio.h, stdlib.h or string.h. Those are the first three I tried; >>there may be others. >> >>So it is not true that you need include stddef.h, nor obvious that that >>is where NULL is defined, if you are used to having it available indirectly. > > Indeed, and it is well documented. > > For example, in the POSIX description for the string functions you'll > find the following statement: > > [CX] Inclusion of the header may also make visible all > symbols from . [Option End] > > This is true for a number of POSIX headers, include those you enumerate > above. > > [CX] marks a POSIX extension to ISO C. Interesting. The C standard says that defines NULL and size_t, both of which are also defined in . A number of other symbols from are also defined in other headers. A conforming implementation may not make any other declarations from visible as a result of including . I wonder why POSIX has that "extension". In ISO C, this: #include wchar_t w = L'w'; is a constraint violation, and this: #include int wchar_t = 42; int main(void){} is, I believe, strictly conforming. gcc with glibc on Ubuntu does not implement that extension. gcc with newlib on Windows/Cygwin does. Presumably this is an artifact of the way the respective string.h files are written, having nothing directly to do with the compiler. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */