On 19 Oct 2000, Lars Gullik Bjønnes wrote:

> Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes:
> 
> | >>>>> "Lars" =3D=3D Lars Gullik Bj=F8nnes <[EMAIL PROTECTED]> writes:
> |=20
> | Lars> We don't want it in the .h file use a unsigned logn as parameter
> | Lars> to the lyx::mkdir
> |=20
> | I've done it already. BTW, is there a readon why we still have in
> | lyxlib.h versions of functions taking char* as argument instead of
> | string?
> 
> No, not really.
> 
> We should probably also change the ones return ing char * to return a
> string.
> f.ex. getcwd should change to:
> 
> string const getcwd() {
>         char buf[MAX_PATH];
> #ifndef __EMX__
>         ::getcwd(buf, MAX_PATH);
> #else=20
>         ::_getcwd2(buf, MAX_PATH);=20=20
> #endif
>         string ret(buf);
>         return ret;
> }

If you do it this way it's better to make it as:

return string(buf);

Simpler, and compilers can better optimize this construct. Theoretically
they should have no problem with the former construct, but the compilers
are not that good in optimizing. And you still lose nothing in
readability.

-- 
  Baruch Even

http://techst02.technion.ac.il/~sbaruch/   (My Site)
http://www.redrival.com/jindor/            (My brothers AD&D site)

" Learn to laugh ... it's the path to true love! " 
   - The Angel in the movie Michael


Reply via email to