[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lyx-devel
Subject:    Re: LaTeX file handling
From:       "Arnd Hanses" <Arnd.H.Hanses () rz ! ruhr-uni-bochum ! de>
Date:       1999-07-30 20:32:16
[Download RAW message or body]

On 27 Jul 1999 16:44:49 +0200, Lars Gullik Bj°nnes wrote:

>And even better would be a function that does not clutter up LString
>anymore:
>
>LString discardSign(LString const & str)
>{
>	LString tmp(str);
>	for (int i = 0; i < tmp.length(); ++i)
>		tmp[i] &= 0x7f;
>	return tmp;
>}

I'm trying to write cleaner and more efficient code for this patch.
Would you agree to move all specifically file/path-name related string
handling methods to filetools.C/.h ?

Then, in the example above, which of the following three
implementations would be professional, fast and clean:

1) Using a const function parameter and an additional variable of class
LString. (see above)

2) Using only one non-const variable. (You'll have to instantiate one
in all cases.)

3) Using a pointer to the processed characters within the string
handling loop, instead of accessing it through (slow?) array subscript
iteration. (I saw 'p->s[i]' inside LString, but using a pointer to
LString and doubly dereferencing it like in plain C didn't work and I
don't have a clue if is at all possible.)


Many questions, but I promise to add the answers to the examples in
LString.h, so that those questions will never be asked again and in the
future you'll have the pleasure to just commit the cleanest and most
professional patches on earth :)

Greets,

	Arnd


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic