|
Boost : |
From: Jason Stewart (res0054p_at_[hidden])
Date: 2002-03-14 10:14:19
> >
> > Because that's the library I'm working on. If you look at standard
>library
> > components ordered chronologically by date of invention, early ones
>(mostly
> > C, a few of the early C++ libraries) used unfortunate global state. As
> > time passed, the awareness of the problem increased, and newer libraries
> > almost never retain global state variables, and are thus much much safer.
>
>The current directory is not related in any way to a standard library
>component. It is a fact of life (fopen("test.txt", "r") - where is
>test.txt?) You can ignore it but it will continue to exist; for instance, a
>third-party library can change it and you'll have no recourse.
I agree with this. I think most people agree that global data in a library.
However, the file system library is an interface to the O/S. Therefore I
think it needs to access and understand the current directory.
As to examples, most of the underlying library calls rely on the current
directory if given a relative path as do the Windows common file dialogs.
Reducing dependencies on the current directory is good. Eliminating it is
not in my opinion.
Jason Stewart
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk