From: thagor2008 on
I'm musing on buying a Mac and I'd like to port a lot of my C & C++
unix code over to it. Will it compile without a fight using the Apple
or gcc compiler or are their some major incompatabilities (over and
above the occasional #ifdef being required obviously)?

B2003
From: David Schwartz on
On Jun 17, 2:10 am, thagor2...(a)googlemail.com wrote:
> I'm musing on buying a Mac and I'd like to port a lot of my C & C++
> unix code over to it. Will it compile without a fight using the Apple
> or gcc compiler or are their some major incompatabilities (over and
> above the occasional #ifdef being required obviously)?
>
> B2003

I've ported quite a bit of generic POSIX code. Here are some of the
issues I've encountered:

1) Getting dynamic shared libraries to work correctly ('.so' files)
was a pain.

2) OSX at one time didn't have some re-entrant functions like
gmtime_r. I think it does now, but I'm not sure.

3) OSX has its own atomic operations that are not like most other
OSes.

4) I don't recall why, but some of our signal handling code seems to
special case OSX. Maybe pthread_sigmask wasn't available?

5) For some filesystem operations, we needed extra includes, sys/
mount.h and sys/param.h.

6) Functions that specify 64-bit operations, like 'pread64' and
'stat64' don't exist. The normal versions of those functions typically
support 64-bits already.

That was about it, actually. Nothing major.

DS
From: viza on
On Tue, 17 Jun 2008 02:10:46 -0700, thagor2008 wrote:

> I'm musing on buying a Mac and I'd like to port a lot of my C & C++ unix
> code over to it. Will it compile without a fight using the Apple or gcc
> compiler or are their some major incompatabilities (over and above the
> occasional #ifdef being required obviously)?

From Wikipedia:
[It is] certified to UNIX 03 - the mark for systems conforming to version
3 of the SUS (full compliance).

From: thagor2008 on
On Jun 17, 10:46 am, David Schwartz <dav...(a)webmaster.com> wrote:
> I've ported quite a bit of generic POSIX code. Here are some of the
> issues I've encountered:
>
> 1) Getting dynamic shared libraries to work correctly ('.so' files)
> was a pain.
>
> 2) OSX at one time didn't have some re-entrant functions like
> gmtime_r. I think it does now, but I'm not sure.
>
> 3) OSX has its own atomic operations that are not like most other
> OSes.
>
> 4) I don't recall why, but some of our signal handling code seems to
> special case OSX. Maybe pthread_sigmask wasn't available?
>
> 5) For some filesystem operations, we needed extra includes, sys/
> mount.h and sys/param.h.
>
> 6) Functions that specify 64-bit operations, like 'pread64' and
> 'stat64' don't exist. The normal versions of those functions typically
> support 64-bits already.
>
> That was about it, actually. Nothing major.
>
> DS

Which compiler did you use out of interest?

B2003
From: David Schwartz on
On Jun 17, 5:49 am, thagor2...(a)googlemail.com wrote:

> Which compiler did you use out of interest?

I used 'gcc' on OSX.

DS