Deutsch English Français Italiano |
<85ecya5b68.fsf@nosuchdomain.example.com> 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: Keith Thompson <Keith.S.Thompson+u@gmail.com> 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> <vsj1m8$1f8h2$1@dont-email.me> <vsj2l9$1j0as$1@dont-email.me> <vsjef3$1u4nk$1@dont-email.me> <vsjg6t$20pdb$1@dont-email.me> <vsjjd1$23ukt$1@dont-email.me> <vsjkvb$25mtg$1@dont-email.me> <vsjlkq$230a5$2@dont-email.me> <vsjs5k$2bfc5$2@dont-email.me> <vsjvgu$2fpp1$1@dont-email.me> <GDfHP.1440068$SZca.528582@fx13.iad> 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= Bytes: 3307 scott@slp53.sl.home (Scott Lurndal) writes: > bart <bc@freeuk.com> 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. >>> >>> <stddef.h>, 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 <string.h> header may also make visible all > symbols from <stddef.h>. [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 <string.h> defines NULL and size_t, both of which are also defined in <stddef.h>. A number of other symbols from <stddef.h> are also defined in other headers. A conforming implementation may not make any other declarations from <stddef.h> visible as a result of including <string.h>. I wonder why POSIX has that "extension". In ISO C, this: #include <string.h> wchar_t w = L'w'; is a constraint violation, and this: #include <string.h> 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 */