[TUHS] v7 K&R C

Dave Horsfall dave at horsfall.org
Sat Apr 25 13:37:24 AEST 2020


On Sat, 25 Apr 2020, Rob Pike wrote:

> The ability to call a function pointer fp with the syntax fp() rather 
> than (*fp)() came rather late, I think at Bjarne's suggestion or 
> example. Pretty sure it was not in v7 C, as you observe.

I have never seen that syntax used (and I've been tooling around with Unix 
for decades).  The variable "fp" in an argument list is a pointer to the 
function, not the function itself, so dereference it.

I wouldn't put it past Stroustrup to have it in C++ though, as it pretty 
much has everything else in it.

> Convenient though the shorthand may be, it always bothered me as 
> inconsistent and misleading. (I am pretty sure I used it sometimes 
> regardless.)

Indeed...  My principle is to write code as though the next person to 
maintain it is a psychopathic axe-murderer who knows where you live (or 
perhaps even yourself, a year later)...

-- Dave


More information about the TUHS mailing list