const_at_typedefed_type

John (Eljay) Love-Jensen eljay@adobe.com
Fri Oct 19 13:44:00 GMT 2007


Hi Kalugsky,

> Could you explain, please, why the compiler ignores the 'const' in the functiion 'char_const_param(const TStr name)'.

There is a huge difference between:
char const*
char* const

Your "const TStr" parameter is a char* const.

You need a char const*.  Or a char const* const will do, as well.

Change your typedef to:

typedef char const* TStr;

That will give you a char const* const as your parameter.

HTH,
--Eljay



More information about the Gcc-help mailing list