Anyone want to guess what gcc generates for a==b?0:a-b ? Any ideas why?
-
-
It would be a new feature, not a defect. Including this would have to be well argued. Do you know what C++ does, here?
-
If all existing implementations work this way (null-null==0) it seems like an oversight that it wasn't specified to begin with. BTW a related issue is that relational operators should be defined on null,null (false for <,>; true for <=,>=).
-
I wouldn't be sure that all implementations do this. There are still implementations that have several representations for null pointers. Your idea would put the strain of doing a case analysis on all code that does pointer subtraction.
- 1 more reply
New conversation -
-
-
I defer to
@zygoloid on that. -
It's already fixed in C++, has been for years
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.