From: Keith M. <kei...@us...> - 2009-03-20 14:56:38
|
On Friday 20 March 2009 05:14:22 Michel Boaventura wrote: > We are relutant to put a windows function on PSPP just because this > issue. Well, that's a rather blinkered and myopic attitude, IMHO. Even if you dislike Microsoft's function names, you can still easily work around the issues. > Until now, the code is 100% compatible with both linux and mingw. And, it should not be difficult to keep it so, with minimal effort, and a few well placed `#ifdef _WIN32', or similar conditionals. > >I guess that this is a Mingw issue. No. It is normal behaviour on MS-Windows; MinGW has nothing to do with it, beyond its applicability to the MS-Windows platform. > >C99 says the following about rename: > >[...] Completely irrelevant, in an MS-Windows context; Microsoft's own compiler doesn't claim, (and falls well short on), C99 compliance. > >POSIX defines this behavior as [...] Equally irrelevant; MS-Windows isn't POSIX. > >Whereas Windows has a contradictory specification (see > >http://msdn.microsoft.com/en-us/library/zw5t957f.aspx): > > > > The new name must not be the name of an existing file or > > directory. This is all that matters, in this context. If you want to replace an existing file, by renaming a new one in its stead, then you have to move the old one out of the way first, (or use a function which will explicitly allow such replacement); MSVCRT's rename() function will not do that for you. -- Regards, Keith. |