In C++ is there any difference between the following commands:
delete x;
delete(x);
No, there's absolutely no difference.
It's the same as the difference between:
i = i + 1;
i = i + (1);
i.e. none. delete
is an operator, not a function.
The difference is only if the x
is expanded by a pre-compiler, in which case the semantics of the (x)
will cause an evaluation of the x
expression before calling an operator delete
on the result of that evaluation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With