Movatterモバイル変換


[0]ホーム

URL:


Issue 583 - WG21 CWG Issues
Title
Relational pointer comparisons against the null pointer constant
Status
cd3
Section
7.6.9 [expr.rel]
Submitter
James Widman

Created on2006-05-24.00:00:00 last changed145 months ago

Messages

msg4561 (view)
Date: 2013-04-15.00:00:00

[Moved to DR status at the April, 2013 meeting as paper N3624.]

msg4560 (view)
Date: 2013-04-15.00:00:00

Proposed resolution (April, 2013):

This issue is resolved by the resolution ofissue 1512.

msg1381 (view)
Date: 2006-05-24.00:00:00

In C, this is ill-formed (cf C99 6.5.8):

    void f(char* s) {        if (s < 0) { }    }

...but in C++, it's not. Why? Who would ever need to write(s > 0)when they could just as well write(s != 0)?

This has been in the language since the ARM (and possibly earlier);apparently it's because the pointer conversions (7.3.12 [conv.ptr]) need to be performed on both operands whenever one ofthe operands is of pointer type. So it looks like the"null-ptr-to-real-pointer-type" conversion is hitching a ride with theother pointer conversions.

History
DateUserActionArgs
2014-03-03 00:00:00adminsetstatus: drwp -> cd3
2013-10-14 00:00:00adminsetstatus: dr -> drwp
2013-09-03 00:00:00adminsetmessages: +msg4561
2013-09-03 00:00:00adminsetmessages: +msg4560
2013-09-03 00:00:00adminsetstatus: open -> dr
2006-05-24 00:00:00admincreate

[8]ページ先頭

©2009-2026 Movatter.jp