News for hackers. Stuff that matters.
Re:New C features in GCC 13 by hgs3 on Thursday May 04, 2023 @09:04AM (#35814624)
> nullptr: fixes problems with eg, va_arg

nullptr is an overkill solution. The ambiguity could have been solved by mandating that NULL be defined as (void*)0 rather than giving implementations the choice of (void*)0 or 0.

Re:New C features in GCC 13 by zajio1am on Thursday May 04, 2023 @09:14AM (#35814754)
Are there any mainstream implementation where NULL is not typed as (void *)? That seems like a choice that would cause so many problems (type warnings, va_arg issues), i wonder why would anyone do that.
Re:New C features in GCC 13 by peterfirefly on Thursday May 04, 2023 @09:19AM (#35814819)
Vintage code or code written by vintage coders.

Code written by C++ programmers.

Code written to be both C and C++.

Re:New C features in GCC 13 by ori_b on Thursday May 04, 2023 @10:08AM (#35815572)
No.
Re:New C features in GCC 13 by peterfirefly on Thursday May 04, 2023 @09:16AM (#35814780)
That would have been my preference as well. Either force it to be (void*)0 or, maybe, allow it to be 0 iff it has the same size and parameter passing method.
Re:New C features in GCC 13 by cremno on Thursday May 04, 2023 @10:00AM (#35815450)
dmr would've approved of going a step further - only nullptr, no 0 and (void*)0:

>Although it would have been a bit of a pain to adapt,

>an '89 or '99 standard in which the only source representation

>of the null pointer was NULL or nil or some other built-in token

>would have had my approval.

https://groups.google.com/g/comp.std.c/c/fh4xKnWOQuo/m/IAaOe...