Topic: Omitting empty paranthesis for member functions - your opinion?
Author: grumpy@cbnewse.cb.att.com (Paul J Lucas)
Date: Thu, 20 Jan 1994 16:45:55 GMT Raw View
Author: jarausch@igpm.rwth-aachen.de (Helmut Jarausch)
Date: 19 Jan 1994 15:24:18 GMT Raw View
Omitting empty paranthesis for member(!) functions.
I am just interested in your opinion.
What's wrong with the following reasoning?
Let's assume for a moment the standard included a rule like:
"When a member function is called without any (non-default)
parameters, the (empty) paranthesis are optional"
Then, with this rule
- we would not break any existing C or (older) C++ code, since
when compiling an expression the compiler knows all about
a member of a class (struct)
- we have quite fewer paranthesis since OO-programming includes
lots of member functions without any parameters
- it's easier to convert old C code or to change C++ code
when a plain member of a struct/class now becomes a function,
since we don't have to change the application programms which
didn't use paranthesis after this member.
- When a member (function) --- the application programmer didn't
know it was a function --- is assigned a value but the
member function doesn't return a reference then it would be
possible to generate an error message like
"member .... of class ... is read only" which is
much easier to understand than "assignment to () (not an lvalue)"
Thank you for your comments,
Helmut Jarausch
Institute of Technology
RWTH-Aachen, Germany