[TUHS] MacOS X is Unix (tm)

Derek Fawcus dfawcus+lists-tuhs at employees.org
Wed Jan 4 03:59:26 AEST 2017

On Tue, Jan 03, 2017 at 09:39:36am -0800, David wrote:
> I’m running Yosemite, Sierra won’t run on my hardware.
> Does the standard expect an int to be a specific size? I can’t imagine this to be the case.
> On Mac ints are 32 bits, as are longs. Unlike Linux where long defaults to 64 bits.


$ uname -a
Darwin Old-MBA.local 14.5.0 Darwin Kernel Version 14.5.0: Sun Sep 25 22:07:15 PDT 2016; root:xnu-2782.50.9~1/RELEASE_X86_64 x86_64
$ cat size.c
#include <stdio.h>

int main()
	printf("sz(int) = %lu, sz(long) = %lu\n",
		(unsigned long)sizeof(int),
		(unsigned long)sizeof(long));
	return 0;

$ cc -o size size.c
$ ./size
sz(int) = 4, sz(long) = 8
$ file size
size: Mach-O 64-bit executable x86_64
$ cc -m32 -o size size.c
$ ./size
sz(int) = 4, sz(long) = 4
$ file size
size: Mach-O executable i386

As I recall the same applies on linux for amd64, with the size of
logn changing depending upon if one compiles as x86 or amd64.

ILP32 vs LP64


More information about the TUHS mailing list