This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: a question about const and pure functions.


    A "const" call has no side-effects and its results depend purely on the
    values of its arguments.  This closely follows the mathematical notion
    of a "function".  A "pure" call has no side-effects, but in addition to
    it's arguments may depend upon the memory/global variables of the system.

"The devil is in the details", as they say!  Is memoization considered
a "side-effect", for example?  What about a function passed a pointer and
which indirectly modifies that point?  Is that a "side-effect"?  It's
very tricky to get definitions exactly right.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]