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: C++ FE stripping const qualifiers from function prototypes (bug or feature?)


Diego Novillo wrote:

> Remove the const in the C FE.  A const qualifier in a pass-by-value
> argument does not really add any useful information.  It's different
> if this was a pass-by-reference.

Just to be completely clear: top-level cv-qualifiers (don't forget
volatile, and don't forget to think about restrict) are removed from the
type of function parameters when computing the type of the function.
However, they do of course apply *within* the function; you cannot
change a parameter of type "const int i".

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


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