C
C. J. Clegg
I read somewhere that in a function call, one should never put
whitespace in front of the opening paren.
Example:
int theArg;
x = foo ( theArg ); /* bad */
x = foo( theArg ); /* OK, no white before opening paren */
The reasoning, if I recall it correctly, had something to do with the
difference between a function call and a macro call, i.e. if the first
example above is actually a call to a macro and not a function, it
might not work as expected.
The place where I read this makes an emphatic point that a programmer
is never entitled to know if an apparent function call is actually a
call to a macro, so one should not put any whitespace in front of the
call, so that it will work in all cases.
Can someone please refresh my memory on this and fill in the details?
Thanks...
whitespace in front of the opening paren.
Example:
int theArg;
x = foo ( theArg ); /* bad */
x = foo( theArg ); /* OK, no white before opening paren */
The reasoning, if I recall it correctly, had something to do with the
difference between a function call and a macro call, i.e. if the first
example above is actually a call to a macro and not a function, it
might not work as expected.
The place where I read this makes an emphatic point that a programmer
is never entitled to know if an apparent function call is actually a
call to a macro, so one should not put any whitespace in front of the
call, so that it will work in all cases.
Can someone please refresh my memory on this and fill in the details?
Thanks...