在 2025-5-9 22:24, наб 写道:
On Fri, May 09, 2025 at 10:31:38AM +0800, LIU Hao wrote:
在 2025-5-4 22:24, наб 写道:
In C++ it's common to have `NULL` defined as `0`.
This is not the case. I think I was a little overzealous to say that
"C++11 <=> NULL=nullptr" (both C and C++ allow any "null-pointer constant"),
but both GCC and Clang define it as __null.

`NULL` is `0` if it's MSVC. Also, I believe you have read LLVM source; we 
prefer the MSVC definition
(clang/lib/Headers/__stddef_null.h):

   ```
   #ifdef __cplusplus
   #if !defined(__MINGW32__) && !defined(_MSC_VER)
   #define NULL __null
   #else
   #define NULL 0
   #endif
   #else
   #define NULL ((void*)0)
   #endif
   ```


Even /if/ this weren't the case, mingw-w64 /already/ uses the conventional
   #define NULL __null
in /some/ headers, but not others. Even /if/ this is legal,
having inconsistent NULL values is undesirable
and fixing it to be consistent is also a good goal.

Please reconsider.

Yes there's inconsistency, but as shown above, I'd prefer we define `NULL` as 
zero in C++.





--
Best regards,
LIU Hao

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to