Rob Pike <robpike(a)gmail.com> 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've seen some interesting discussion about Dave Horsfall's favourite
retro-C definition of abort():
int abort 4;
...
abort();
https://minnie.tuhs.org/pipermail/tuhs/2020-March/020680.html
In particular a lot of people didn't know that function pointers could not
be called like abort() so they didn't realise that 4 was the machine code
contents of the function, not the address of the function. (Extra
confusing since branching to address 4 was also a plausible way to crash
the program...)
But that made me wonder what 7th-and-earlier C would do if you tried to
call a local variable. I guess that would lead to the compiler saying
error("Call of non-function");
Tony.
--
f.anthony.n.finch <dot(a)dotat.at>
http://dotat.at/
Hebrides, Bailey, Fair Isle, Faeroes: Northeasterly 4 to 6, occasionally 7 at
first in north Fair Isle. Moderate or rough. Showers. Good, occasionally
moderate.