Subject: Re: ISSUE #?? Proposal: const attribute for input params
From: Michael Rohleder (michael.rohleder@motorola.com)
Date: Thu Dec 05 2002 - 10:51:34 PST
See the attached main.c and the resulting 'nm' result...
Nuff said.
-Michael
Kevin Cameron x3251 wrote:
> > From michael.rohleder@motorola.com Wed Dec 4 05:43:10 2002
> >
> > Hi Kevin,
> >
> > I am amazed that you say this. Yes, "const" has no impact on linking in C,
> > but I am far away from naming it therefore syntactic sugar.
> > And in case of C++ it is part of the name mangling and therefore has even
> > impact on linking!
> >
> > -Michael
>
> If "const" was actually part of C++ name mangling it would be quite happy since
> it would be another reason for using C++ instead of C. Unfortunately it isn't
> (I tried it out before the last e-mail):
>
> void foo(int bar);
>
> and
>
> void foo(const int bar);
>
> are considered the same wrt linking. The return type is not considered either, so
>
> int foo(int bar);
>
> is also the same.
>
> NB: even if an argument is declared "const", it is only advisory, you can cast
> away the const (that's why it's syntactic sugar).
>
> Kev.
>
> > Kevin Cameron x3251 wrote:
> >
> > > "const" is syntactic sugar in C (and C++), it has no impact on linking. While I agree that it is good
> > > to put it in example mappings in the LRM, there is no way to force users use "const" in their C code.
> > >
> > > Kev.
--NOTE: The content of this message may contain personal views which are not neccessarily the views of Motorola, unless specifically stated.
___________________________________________________ | | _ | Michael Rohleder Tel: +49-89-92103-259 | _ / )| Software Technologist Fax: +49-89-92103-680 |( \ / / | Motorola, Semiconductor Products, System Design | \ \ _( (_ | _ Schatzbogen 7, D-81829 Munich, Germany _ | _) )_ (((\ \>|_/ > < \_|</ /))) (\\\\ \_/ / mailto:Michael.Rohleder@motorola.com \ \_/ ////) \ /_______________________________________________\ / \ _/ \_ / / / \ \
The information contained in this email has been classified as: Motorola General Business Information (x) Motorola Internal Use Only ( ) Motorola Confidential Proprietary ( )
*** This note may contain Motorola Confidential Proprietary or Motorola Internal Use Only Information and is intended to be reviewed by only the individual or organization named above. If you are not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any review, dissemination or copying of this email and its attachments, if any, or the information contained herein is prohibited. If you have received this email in error, please immediately notify the sender by return email and delete this email from your system. Thank you! ***
This archive was generated by hypermail 2b28 : Thu Dec 05 2002 - 10:52:10 PST