why INT in postfix overloading

I was wondering why in C++ when you overload an operator for postfix operations that it takes in an INT?

Would it makes sence to create a command such as POST to take in?  Thanks.
sarniscoolAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
jasonclarkeConnect With a Mentor Commented:
Nothing really... all Bjarne Stroustrup has to say is:

'...Other unary operators are prefix and take no arguments when defined as member functions.  The "odd" and unused dummy int argument is used to indicate the odd prefix operators.  In other words, in the postfix case, ++ comes between the first (real) operand and the second (dummy) argument and is thus postfix."

it is purely a convention, for no real reason.... BS states he would have preferred 'prefix' and 'postfix' keywords.
0
 
jasonclarkeCommented:
It is just a dummy parameter, as you are no doubt aware, to differentiate between postfix and prefix.

One of the basic design goals of C++ was to avoid unnecessary new keywords (although in this case Bjarne Stroustrup states that he would actually have preferred new keywords).

This led to the use of this convention, which is, as you imply a bit of a language wart.

If you want to find out more, read the Design & Evolution of C++ (by Bjarne Stroustrup), section 11.5.3.
0
 
sarniscoolAuthor Commented:
Is that it?  No special reason other than to differentiate?  Why INT out of all the other C++ keywords?
0
 
sarniscoolAuthor Commented:
alright, thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.