C++ delete syntax

This is undoubtedly an error. The comma here is the comma operator, not a separator. Only the first pointer, ptr1 is deleted.

The second pointer, ptr2, is just a do-nothing expression.

The delete operator has higher precedence than the , operator, so the expression is parsed as if it were written:

(delete ptr1) , (ptr2)

and not as if it were written:

delete (ptr1 , ptr2)

If , had higher precedence than delete, then only the second pointer would be deleted.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)