Re: Glib: a Win32 discussion

On 4/7/2011 4:29 PM, Colin Walters wrote:
If your application deals with uids, I think you're going to end up
with platform-specific code; the complexities around identity are just
too high.  That goes doubly for inode numbers, which - why would you
care unless you're a backup app, and then you're *definitely* going to
get into platform specific stuff.
In the context of stat, I disagree. Let's suppose you were making a new-fangled version of tar. Forget for the moment that the specification for tar may impose limitations on how many bits wide uid/gid's are. You want your code to be as minimally system-dependent as possible, so you use glib. If glib provides its own GlibStat structure, and the elements in that structure are sufficiently wide for all current platforms and reasonable use, this is useful. That program needs to know if two files are the same so it checks on inode numbers and only includes the body of the file once in the archive. So far, nothing particularly system dependent there. If you *DO* need system dependent stuff, *then* you can use struct stat (or whatever structure you like), with suitable conditionals protecting that code, but the average code path that uses struct stat to check for minimal information such as file size, last modification time and occasionally ownership (frequently just checking to see if uid/gid are 0) having a platform-independent structure is a big win for portability.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]