This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: a question about const and pure functions.
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- To: stevenb at suse dot de
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 11 Nov 04 10:30:19 EST
- Subject: Re: a question about const and pure functions.
So write it down.
You have to agree on them first! At least one language standardization
committee spent many hours on the question of pure and memoization.
But your example is obvious - if the function is passed a pointer and
it modifies it, that is clearly a side-effect because it is a a change
that cannot be seen directly from the caller's side.
I agree that it should be considered a side-effect, but that makes the
definition of "side-effect" a little harder to state.