Port-vax archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: vax/ddb(4): clean up machine dependent code and improve usability
> It's not a change you made, but it occurs in the diff a lot:
> [...function pointers...(*pf)(...) equivalent to pf(...), or for that
> matter to (*****pf)(...)...]
True. But just because you _can_ do something doesn't mean you
_should_. You can also swap the operands of [] if you feel like
it (eg, char *s; int i; ...i[s]...), but that doesn't mean it's a good
idea to.
Personally, I always use (*pf)() instead of pf() when calling through a
(materialized) pointer value, as a reminder to the reader that the
function is being called through a pointer instead of being called
directly by name. (This is especially important if the pointer comes
from a variable which shadows a function of the same name, though such
shadowing is argpuably a Bad Thing regardless.)
In my opinion, the potential for confusion is great enough that making
"call function by name" and "call function through pointer" textually
distinct is worth doing. After all, they are conceptually distinct,
even if C turns the former into the latter formally.
> And yes, this means you really can use "C++-like syntax" like
> ptr->member(arg1, arg2)
Yes, you can. Again, I prefer to not; I find the clarity resulting
from the (* ) textual reminder that there's a materialized pointer
involved worth the three source-code characters involved.
/~\ The ASCII Mouse
\ / Ribbon Campaign
X Against HTML mouse%rodents-montreal.org@localhost
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
Home |
Main Index |
Thread Index |
Old Index