Re: r29342 - lyx-devel/trunk/src

2009-04-21 Thread Andre Poenitz
On Tue, Apr 21, 2009 at 08:48:50PM +0200, Jean-Marc Lasgouttes wrote: > Bernhard Roider writes: > > > Jean-Marc Lasgouttes schrieb: > > > >> Yes, but what if I keep a reference to the temporary variable that > >> gets returned? Does my reference point to neverland? > > > > Yes it does. Or more pr

Re: r29342 - lyx-devel/trunk/src

2009-04-21 Thread Jean-Marc Lasgouttes
Bernhard Roider writes: > Jean-Marc Lasgouttes schrieb: > >> Yes, but what if I keep a reference to the temporary variable that >> gets returned? Does my reference point to neverland? > > Yes it does. Or more precisely it points to somewhere on the stack > because local variables in functions are

Re: r29342 - lyx-devel/trunk/src

2009-04-21 Thread Bernhard Roider
Jean-Marc Lasgouttes schrieb: Yes, but what if I keep a reference to the temporary variable that gets returned? Does my reference point to neverland? Yes it does. Or more precisely it points to somewhere on the stack because local variables in functions are allocated on the stack. When the fu

Re: r29342 - lyx-devel/trunk/src

2009-04-20 Thread Jean-Marc Lasgouttes
If you "assign" some temporary (like a _copy_ returned from some function) to a reference, the lifetime of that temporary will not end at the end of the full expression (which usually marks the end of life of temporaries), but will be extended to the end of the block in which the reference is defi

Re: r29342 - lyx-devel/trunk/src

2009-04-20 Thread Andre Poenitz
On Mon, Apr 20, 2009 at 10:56:03PM +0200, Jean-Marc Lasgouttes wrote: >> A function may not return a reference to a local variable. You should >> at least get a warning. > > Yes, but what if I keep a reference to the temporary variable that gets > returned? Does my reference point to neverland?

Re: r29342 - lyx-devel/trunk/src

2009-04-20 Thread Jean-Marc Lasgouttes
Now that i think about your arguments again: that was not the problem here, but it is the answer for JMarc's question: > OK, so all the changes were wrong. Now, how can I change my function > signature to indicate that the return value is a temporary and that an > address should not be kept?

Re: r29342 - lyx-devel/trunk/src

2009-04-20 Thread Bernhard Roider
Bernhard Roider schrieb: Abdelrazak Younes schrieb: Jean-Marc Lasgouttes a écrit : Le 20 avr. 09 à 00:25, Jean-Marc Lasgouttes a écrit : Le 19 avr. 09 à 23:13, Abdelrazak Younes a écrit : +docstring const fls = flattenLabelString(it->first, false, callers); docstring const & ? Inde

Re: r29342 - lyx-devel/trunk/src

2009-04-20 Thread Bernhard Roider
Abdelrazak Younes schrieb: Jean-Marc Lasgouttes a écrit : Le 20 avr. 09 à 00:25, Jean-Marc Lasgouttes a écrit : Le 19 avr. 09 à 23:13, Abdelrazak Younes a écrit : +docstring const fls = flattenLabelString(it->first, false, callers); docstring const & ? Indeed, thanks. Now that I t

Re: r29342 - lyx-devel/trunk/src

2009-04-20 Thread Andre Poenitz
On Mon, Apr 20, 2009 at 12:03:42PM +0200, Jean-Marc Lasgouttes wrote: > Abdelrazak Younes writes: > > This essentially depends on bar(). If bar() generates a new string, it > > should of course return a copy and you should not use a const ref. If > > bar() returns a reference or a const reference

Re: r29342 - lyx-devel/trunk/src

2009-04-20 Thread Abdelrazak Younes
Jean-Marc Lasgouttes a écrit : Abdelrazak Younes writes: This essentially depends on bar(). If bar() generates a new string, it should of course return a copy and you should not use a const ref. If bar() returns a reference or a const reference to an internal string, then you can save a copy by

Re: r29342 - lyx-devel/trunk/src

2009-04-20 Thread Jean-Marc Lasgouttes
Abdelrazak Younes writes: > This essentially depends on bar(). If bar() generates a new string, it > should of course return a copy and you should not use a const ref. If > bar() returns a reference or a const reference to an internal string, > then you can save a copy by using a const ref too. O

Re: r29342 - lyx-devel/trunk/src

2009-04-20 Thread Abdelrazak Younes
Jean-Marc Lasgouttes a écrit : Le 20 avr. 09 à 00:25, Jean-Marc Lasgouttes a écrit : Le 19 avr. 09 à 23:13, Abdelrazak Younes a écrit : +docstring const fls = flattenLabelString(it->first, false, callers); docstring const & ? Indeed, thanks. Now that I think of it, how come that we

Re: r29342 - lyx-devel/trunk/src

2009-04-19 Thread Andre Poenitz
On Mon, Apr 20, 2009 at 12:32:21AM +0200, Jean-Marc Lasgouttes wrote: > Le 20 avr. 09 à 00:25, Jean-Marc Lasgouttes a écrit : >> Le 19 avr. 09 à 23:13, Abdelrazak Younes a écrit : + docstring const fls = flattenLabelString(it->first, false, callers); >>> docstring const & ? >>

Re: r29342 - lyx-devel/trunk/src

2009-04-19 Thread Jean-Marc Lasgouttes
Le 20 avr. 09 à 00:25, Jean-Marc Lasgouttes a écrit : Le 19 avr. 09 à 23:13, Abdelrazak Younes a écrit : + docstring const fls = flattenLabelString(it->first, false, callers); docstring const & ? Indeed, thanks. Now that I think of it, how come that we have lots of string const foo = ba

Re: r29342 - lyx-devel/trunk/src

2009-04-19 Thread Jean-Marc Lasgouttes
Le 19 avr. 09 à 23:13, Abdelrazak Younes a écrit : + docstring const fls = flattenLabelString(it->first, false, callers); docstring const & ? Indeed, thanks. JMarc

Re: r29342 - lyx-devel/trunk/src

2009-04-19 Thread Abdelrazak Younes
On 19/04/2009 22:05, lasgout...@lyx.org wrote: Author: lasgouttes Date: Sun Apr 19 22:05:26 2009 New Revision: 29342 URL: http://www.lyx.org/trac/changeset/29342 Log: Speedup the expandLabel by avoiding the recursive part. The labelstrings are computed recursively to get rid of any \thexxx strin