This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Is fastcall broken?
- From: Andrew Haley <aph-gcc at littlepinkcloud dot COM>
- To: Daniel Lohmann <daniel dot lohmann at informatik dot uni-erlangen dot de>
- Cc: Angus <angus at uducat dot com>, gcc-help at gcc dot gnu dot org
- Date: Mon, 2 Jul 2007 10:43:23 +0100
- Subject: Re: Is fastcall broken?
- References: <11348451.post@talk.nabble.com> <18052.50539.439814.156288@zebedee.pink> <11359697.post@talk.nabble.com> <4686327A.3080106@informatik.uni-erlangen.de> <18054.14291.118304.751789@zebedee.pink> <46864C93.3030809@informatik.uni-erlangen.de>
Daniel Lohmann writes:
> Andrew Haley schrieb:
> > Daniel Lohmann writes:
> > > Angus schrieb:
> > > >
> > > > BTW, in my opinion it is dangerous. Usually one can rely on
> > > > compile or link errors to catch mismatched function
> > > > characteristics, but with attributes there is no such
> > > > checking. So even if you aren't doing something *really*
> > > > dangerous, like working with virtual methods, you might do what I
> > > > did, and you'll never know about it until you notice you've
> > > > mismatched your attributes. So if you ask me, attributes like
> > > > this one should be used sparingly, and with much caution.
> > >
> > > I would consider this as a significant defect of gcc's attribute handling.
> > > Attributes that change a function to a non-standard calling convention
> > > effectively modify the interface of the function, which should be encoded
> > > into the (mangled) symbol name. Thereby incompatible prototypes on on the
> > > caller and callee side could be detected at link-time.
> >
> > But attributes such as fastcall are used in C programs, and C doesn't
> > do mangling.
>
> But in this cases it should!
C doesn't have type-safe linkage: that is one of its features. C++ is
for people who like type-safe linkage.
> > I don't know that many people combine C++ and weirdo attributes
> > like fastcall.
>
> You would be surprised. C++ is facing an immense popularity gain in the
> embedded systems community. And these people (I am one of them...) often
> need a much finer control over code generation.
OK.
Andrew.