This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Const in default function arguments?
- From: John Love-Jensen <eljay at adobe dot com>
- To: Eric Lemings <eric at lemings dot com>, <gcc-help at gcc dot gnu dot org>
- Date: Fri, 04 Apr 2003 06:31:59 -0600
- Subject: Re: Const in default function arguments?
Hi Eric,
>Why won't the non-const version compile?
Because by making it a non-const reference, you are saying that you are
going to modify it. That is to say, you are making an "OUT" or "UPDATE"
(in/out) parameter.
When you specify a default object, you are making a temporary.
It doesn't make sense to modify a temporary.
--Eljay