inlining...
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon Mar 17 08:36:37 PDT 2014
On 3/17/14, 6:26 AM, Manu wrote:
> On 15 March 2014 14:55, Manu <turkeyman at gmail.com
> <mailto:turkeyman at gmail.com>> wrote:
>
> On 15 March 2014 14:33, Daniel Murphy <yebbliesnospam at gmail.com
> <mailto:yebbliesnospam at gmail.com>> wrote:
>
> "Manu" <turkeyman at gmail.com <mailto:turkeyman at gmail.com>> wrote
> in message
> news:mailman.128.1394856947.__23258.digitalmars-d at puremagic.__com...
>
> > Haven't we already agreed a pragma for force inline
> should be > implemented. Or is
> > that something I have dreamed?
>
> It's been discussed. I never agreed to it (I _really_ don't
> like it), but I'll take it if it's the best
> I'm gonna get.
>
> I don't like stateful attributes like that. I think it's
> error prone, especially when it's silent.
> 'private:' for instance will complain if you write a new
> function in an area influenced by the
> private state and try and call it from elsewhere; ie, you
> know you made the mistake.
> If you write a new function in an area influenced by the
> forceinline state which wasn't intended
> to be inlined, you won't know. I think that's dangerous.
>
>
> Huh? The pragma could easily be restricted to apply to exactly
> one function declaration, if that's what's desired.
>
>
> Then why bother with a pragma?
> It's just a special case for the sake of a special case... I don't
> see why resist the language conventions. Where's the precedent for
> that? It just sounds like it's asking to cause edge cases and
> trouble down the line.
> Is it gonna get messy when it involves with templates? What about
> methods, sub-functions?
>
>
> *bump*
> I actually care about this a whole lot more than final-by-default right
> now ;)
>
> I'd like to think there's a possible solution to these problems that
> everyone agrees with.
I'd like to see a solution to inlining along the lines of "pliz pliz
inline" (best effort) and "never inline".
Outlining only at a specific call site is seldom needed and when it is
it's trivially achievable with a noinline function forwarding to the
inline function. Inlining only at a specific call site is a tall order
and essentially impossible if header generation had been used.
Andrei
More information about the Digitalmars-d
mailing list