Boost logo

Boost :

From: Stewart, Robert (stewart_at_[hidden])
Date: 2002-03-05 13:34:50


From: Dietmar Kuehl [mailto:dietmar_kuehl_at_[hidden]]
>
> dir_entry f1("./foo");
> dir_entry f2("/tmp/foo");
> set(user_read, *f1, true);

Is dir_entry a pointer type? I wouldn't expect so, thus making "*f1" look
fishy.

> set(user_read, *f2, false);
> std::cout << get(user_read, *f1) << "\n";
>
> Does this print "0" or "1"? I would expect "0" but I'm about 100% sure
> that a cached implementation would write "1". ... and the result after
> this code would be either the original state if we require an explicit
> "commit" and "1" if the destructor commits the change implicitly.
> However, I would the access attribute to be "0" because this was the
> latest change.

I would expect "0". I would expect that f1 and f2 rely on the same
underlying data structures (your file_rep). Thus, "set(user_read, *f2,
false);" would flush all pending changes. Likewise, any iterator that
refers to the same file should refer to the same file_rep.

Now, having said that, because of the complexities and even performance
issues that might result from those expectations, one could, just as easily,
decide that referencing the same file's attributes via iterators and
multiple dir_entry objects at the same time (I'm not talking about threads,
though that's a whole separate issue), is undefined.

Rob
Susquehanna International Group, LLP
http://www.sig.com


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk