Deutsch English Français Italiano |
<14991c683bdd5ea2aecd380d1624d04c874beaa6@i2pn2.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder9.news.weretis.net!i2pn.org!i2pn2.org!.POSTED!not-for-mail From: Richard Damon <richard@damon-family.org> Newsgroups: comp.lang.c Subject: Re: question about nullptr Date: Sat, 6 Jul 2024 17:04:59 -0400 Organization: i2pn2 (i2pn.org) Message-ID: <14991c683bdd5ea2aecd380d1624d04c874beaa6@i2pn2.org> References: <v6bavg$3pu5i$1@dont-email.me> <20240706054641.175@kylheku.com> <v6bfi1$3qn4u$1@dont-email.me> <l9ciO.7$cr5e.2@fx05.iad> <v6c942$3ui41$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sat, 6 Jul 2024 21:04:59 -0000 (UTC) Injection-Info: i2pn2.org; logging-data="2381981"; mail-complaints-to="usenet@i2pn2.org"; posting-account="diqKR1lalukngNWEqoq9/uFtbkm5U+w3w6FQ0yesrXg"; User-Agent: Mozilla Thunderbird X-Spam-Checker-Version: SpamAssassin 4.0.0 In-Reply-To: <v6c942$3ui41$1@dont-email.me> Content-Language: en-US Bytes: 2397 Lines: 35 On 7/6/24 4:23 PM, Chris M. Thomasson wrote: > On 7/6/2024 7:04 AM, Scott Lurndal wrote: >> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes: >>> On 06.07.2024 14:54, Kaz Kylheku wrote: >>>> On 2024-07-06, Thiago Adams <thiago.adams@gmail.com> wrote: >>>>> If you were creating C code today and could use a C23 compiler, would >>>>> you use nullptr instead of NULL? >>>> >>>> In greenfield projects under my dictatorship, I use 0, as in: >>>> >>>> char *p = 0; >>>> >>>> I was still 20 something when I (easily) wrapped my head around the 0 >>>> null pointer constant, and have not had any problems with it. >>>> Once I learned the standard-defined truth about null pointer constants, >>>> and their relationship to the NULL macro, I dropped NULL like a hot >>>> potato, and didn't look back (except when working in code bases that >>>> use >>>> NULL). >>> >>> We also used 0 as "universal" pointer value regularly without problems. >> >> Whereas I spent 6 years programming on an architecture[*] where a >> null pointer was represented in hardware by the value 0xc0eeeeee. I >> always >> use the NULL macro in both C and C++ code. > > Where: > > void* x = 0; > > Should be x = 0xc0eeeeee, right? > Maybe when the representation of x is examined by reinterpreting it as an array of character types (like unsigned char).