Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!uwvax!oddjob!gargoyle!ihnp4!drutx!alanr From: alanr@drutx.ATT.COM (RobertsonAL) Newsgroups: comp.sys.ibm.pc Subject: NOT a turbo C bug Message-ID: <4886@drutx.ATT.COM> Date: Wed, 12-Aug-87 19:14:09 EDT Article-I.D.: drutx.4886 Posted: Wed Aug 12 19:14:09 1987 Date-Received: Sat, 15-Aug-87 04:39:27 EDT Distribution: comp Organization: AT&T, Denver, CO Lines: 24 Keywords: Turbo C In my version of Turbo C, the following program fails on several memory models. /* * This program works correctly on the tiny, small, and medium models, * but fails with the compact, large and huge models. */ main() { char * junk1, *junk2; junk1 = (char *)malloc(1000); junk2 = (char *)malloc(1000); /* Malloc had better return new value*/ printf("junk1=%p, junk2=%p\n", junk1, junk2); printf("%s\n", (junk1 == junk2 ? "OOPS." : "OK.")); } This program writes OOPS under the circumstances described above. HOWEVER, if you include , then the problem goes away, because malloc isn't properly declared to return a pointer (32 bits) instead of an int (default). -- Alan Robertson AT&T Information Systems 11900 N Pecos Room 31F-14 Denver, Colorado 80234 (303)-538-4796 drutx!alanr