Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!wuarchive!decwrl!bacchus.pa.dec.com!shlump.nac.dec.com!mountn.dec.com!minow From: minow@mountn.dec.com (Martin Minow) Newsgroups: comp.sys.mac.programmer Subject: Re: Think C and MPW C byte ordering Message-ID: <1803@mountn.dec.com> Date: 31 Jul 90 02:41:28 GMT References: <684@dg.dg.com> Reply-To: minow@bolt.enet.dec.com (Martin Minow) Organization: Digital Equipment Corporation Lines: 34 In article <684@dg.dg.com> bkahn@archive.rtp.dg.com (Bruce Kahn) writes: > > I am new to programming the 68K and have a quick question for you Mac C >gurus out there. What is the byte ordering of the values generated by >both Think C 4.x and MPW C 3.x? I own both but cant seem to find the >information in any of the manuals. They probably wanted you to ignore the byte ordering (doing so makes your code portable to a "real" computer, such as a Vax). If you must know, try writing a program like union { short foo; char bar[sizeof (short)]; } stuff; int i; for (i = 0; i < sizeof (short); i++) stuff.bar[i] = i; printf("%x\n", stuff.foo); to see what the order is. > Also, can someone pls tell me the sizes and values for variables >declared as Ctype * under Think C? Under MPW its 4 bytes, 0 to >4294967295. Thanks. Pointer types are 4 bytes in both implementations. MPW int's are 4 bytes, I am told, while int's in Think C are 2 bytes. Either is "correct" given the Motorola 68000 architecture. Here, too, printf("%d\n", sizeof (Ctype *)) would give you the answer. Martin Minow minow@bolt.enet.dec.com