5 ms·
Cannot find any confirmation to your statement. Otoh "All null pointer values (of compatible typewithin the same address space) are already required to compare
by IWeldMelons 2y ago
Cannot find any confirmation to your statement. Otoh "All null pointer values (of compatible typewithin the same address space) are already required to compare equal. " in the limked paper.
- PaulDavisThe1st 2y agoNULL is not single type in any conventional sense (and is actually tricky to define in a way that makes it usable in the way most programmers expect). Thus: T1* a = NULL; T2* b = NULL a == b; /* may be undefined at present, depending on the nature of T1 & T2 */
- deleted 2y ago[deleted]
- IWeldMelons 2y ago"NULL" in fact is a macro, not a part of the language. null (zero pointer) is, and it is explicitly defined in standard, that comparison of two null pointers lead to equality. You example simply won't compile, it is not undefined; the pointers simply are of different type, period. here what standard says: "A pointer to void may be converted to or from a pointer to any object type. Conversion of a null pointer to another pointer type yields a null pointer of that type. Any two null pointers shall compare equal." therefore, convert any of them or both to void amd compare. you'll get equality.