C++ delete syntax -
I have come into this abnormal use of 'deletion'. Just wanted to know whether the following line removes both pointers or only the first?
Here the comma is a comma operator, not a separator. Only the first pointer, ptr1
has been removed.
The second indicator, ptr2
, is just one-none expression.
Delete
has a higher preference than operator ,
operator, so the expression is written as written:
(remove ptr1), (ptr2)
and not as it was written:
delete (ptr1, ptr2)
If ,
to delete
, then only the second pointer will be deleted.
Comments
Post a Comment