E
E. Robert Tisdale
Is a function an object?
Is a function an object?
E. Robert Tisdale said:Is a function an object?
Is a function an object?
E. Robert Tisdale said:Is a function an object?
E. Robert Tisdale said:Is a function an object?
E. Robert Tisdale said:Is a function an object?
Thomas Gagne said:I like Alan's explanation. He correctly prefaces it with, "It depends!"
Functions existing as objects themselves is a powerful concept that escapes
many programmers. It is worth investigating.
Phlip said:E. Robert Tisdale wrote:
Is a barnacle a ship?
E. Robert Tisdale said:Is a function an object?
Thomas said:Mr. Tisdale,
Please define "object".
It comes down to semantics. In the C standard, "object" is defined as dataE. Robert Tisdale said:Is a function an object?
Malcolm said:It comes down to semantics. In the C standard, "object" is defined as data
occupying a contiguous region of storage. However if you said "what object
does that pointer point to?" and someone replied "it's a function pointer to
printf()" most people would accept the exchange as grammatical.
In C++ you can have "function objects" which are a template-safe form of
function pointer.
In C, given approriate support, you can create data objects which specify
functions. For instance you could write a parser that calculates a function
of x and y, written in mathematical notation.
I like Alan's explanation. He correctly prefaces it with, "It
depends!" Functions existing as objects themselves is a powerful
concept that escapes many programmers. It is worth investigating.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.