Deutsch   English   Français   Italiano  
<vsjvgu$2fpp1$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: bart <bc@freeuk.com>
Newsgroups: comp.lang.c
Subject: Re: "A diagram of C23 basic types"
Date: Wed, 2 Apr 2025 19:26:39 +0100
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <vsjvgu$2fpp1$1@dont-email.me>
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>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 02 Apr 2025 20:26:38 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="6ec1d618f3662fc028ed5e5779922e31";
	logging-data="2615073"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+cqaEwtS21IagMmRbkC2OS"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:t3UXkhCkpzZqHz0rwQOqnUCbjdE=
In-Reply-To: <vsjs5k$2bfc5$2@dont-email.me>
Content-Language: en-GB
Bytes: 2406

On 02/04/2025 18:29, David Brown wrote:
> On 02/04/2025 17:38, bart wrote:
>> On 02/04/2025 16:26, Muttley@DastardlyHQ.org wrote:

>>> Never understood that in C++ never mind C. NULL has worked fine for 
>>> 50 years.
>>
>> And it's been a hack for 50 years. Especially when it is just:
>>
>>    #define NULL 0
> 
> 
> The common definition in C is :
> 
>      #define NULL ((void*) 0)
> 
> Some compilers might have an extension, such as gcc's "__null", that are 
> used instead to allow better static error checking.
> 
> (In C++, it is often defined to 0, because the rules for implicit 
> conversions from void* are different in C++.)
> 
>>
>> 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.