Re: ISO versions of open(), read(), lseek()
Re: ISO versions of open(), read(), lseek()
- Subject: Re: ISO versions of open(), read(), lseek()
- From: Alastair Houghton <email@hidden>
- Date: Tue, 4 Jan 2011 23:09:35 +0000
On 4 Jan 2011, at 19:16, Todd Heberlein wrote:
> I have to maintain some C++ code between Xcode on a Mac and Visual Studio on Windows, and the Windows compiler kindly encouraged me to use the ISO versions of open(), read(), lseek() and so on (these are _open(), _read(), _lseek() ... (and seem to be defined in io.h)).
There's no such thing as "the ISO versions" of open(), read(), lseek() et al. ISO (or in reality ANSI) doesn't define any of those functions; POSIX does, but the versions included with Visual Studio are not POSIX compliant (though they are similar and *mostly* compatible if you're careful).
Prepending the underscores was a strange decision IMO; I don't think they can really justify it from a compliance perspective (since the presence of those functions in the standard library won't affect a strictly compliant program that defines its own functions with similar names---the linker simply won't link the library code in), and it makes it harder to write portable programs because you end up needing things like
#ifdef _WIN32
#define stat _stat
#endif
(*very* common in portable software).
Mac OS X, of course, is POSIX compliant (and has the certificate to prove it).
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden