19.01.2013 0:36, Max Kellermann пишет:
>
> Yes, why not.  OTOH, we could pass "Path&" to our readlink() wrapper,
> and let the wrapper copy the result into the object.  Or make it
> return a "Path".  That would be most convenient to use.  Adds some
> overhead, but acceptable for me.

If you don't mind some overhead, I'd like to have more natural API.

Important thing for wrappers is error management:
errno might be messed in between because constructing Path might change 
it. What are options here?

> Let's give them better names, to avoid namespace collisions with
> system macros.  OpenFile(), StatFile() etc.

There is already open_cloexec() one of them has to be implemented via 
another or they could be merged altogether. What do you think?

Also I'd prefer not to keep procedural interface of 
opendir()/readdir()/closedir(), but to have some wrapper class.

>
> Configuration file is always assumed to be UTF-8.
>

Don't that breaks existing configuration files? Probably you can correct 
me but I've never seen path conversion there so they are in FS encoding 
at the moment.

Also I've forgot about logging. Should logs be UTF-8 too? What if 
logging is redirected to stderr. In that case FS encoded paths are expected.

>
> I often try to imitate the STL naming, not because I like it (I don't,
> not at all!), but to allow exchanging container classes more easily.
> But yes, agree, we could give them better names.
>

Few more style suggestions, very subjective as always:

(this isn't strictly related to Path usage, but would be useful to discuss)

In project I work on we tend to avoid writing abbreviations in all caps. 
For example HTML is spelled Html. This gives some better readability. My 
eyes blow on names such as FLACIOHandle. There are some corner cases 
like Io, Id (they don't look cool IMO). But can't we adopt this approach 
for some longer names (i.e. four or more letters)?
FLACIOHandle would be FlacIOHandle. Anybody knows what FLAC means 
anyway, but Flac is more readable in identifiers.

C++ provides wrappers for standard C headers (e.g. cstdio for stdio.h).
Are there any rules on them? I tend to use them, however they have 
serious disadvantage: it's hard to predict whenever some function would 
appear to std namespace. So should we dismiss those headers?

-- 
Denis

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122912
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to