|
|
Richard Heathfield wrote:
> pete said:
> > Richard Heathfield wrote:
> >> pete said:
> >> > You agreed with:
> >> >
> >> >> PRE31-C. Never invoke an unsafe macro with
> >> >> arguments containing assignment,
> >> >> increment, decrement, or function call
> >>
> >> I wrote:
> >>
> >> "By 'unsafe macro',
> >> SECCODE means a macro that evaluates at least one of
> >> its arguments more than once.
> >> It is clearly a bad idea to pass to such a
> >> macro any argument that has side effects."
> >> The four side effects that are singled(?!)
> >> out in the title are in fact the only four I can think of
> >> but if you do manage to think of any others, don't pass those to
> >> macros either, okay?
> >
> > Which is the fourth side effect singled(?!) out in the title?
> >
> > It looks like "function call",
> > as though you mean to say
> > that a function call is a side effect.
>
> You make a fair point.
> (The review was, after all, written at a ridiculous
> time of day!)
>
> In the Web version of this review,
> I have inserted the following paragraph:
>
> "Note, by the way,
> that function calls only have side effects if they have
> side effects! They are not required to, obviously.
> There is no particular problem with passing, say,
> sin(x) to an 'unsafe' macro, although of course
> there will be a minor performance penalty
> associated with the multiple evaluation."
>
> Will that suit?
Imprimatur!
--
pete
|
|