This is the mail archive of the gcc-help@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: const_at_typedefed_type


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


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