Path: utzoo!mnetor!uunet!husc6!bbn!uwmcsd1!marque!gryphon!root
From: root@gryphon.CTS.COM (The Super User)
Newsgroups: comp.sys.ibm.pc
Subject: Re: Turbo C vs. Microsoft
Message-ID: <2606@gryphon.CTS.COM>
Date: 16 Dec 87 08:06:57 GMT
References: <4516@teddy.UUCP>
Reply-To: root@gryphon.CTS.COM (The Super User)
Organization: Trailing Edge Technology, Redondo Beach, CA
Lines: 61

In article <4516@teddy.UUCP> jpn@teddy.UUCP (John P. Nelson) writes:
>compiler, but it generates fast code.  One thing that surprised me
>was that it generated BIGGER code than Turbo C, even if it was faster.
>I also tried Microsoft C with the -Ox option on MicroEmacs, but that made
>even larger code.

Microsoft C optimizes by default.  Specifying -Ox enables loop optimzation,
in-line intrinsic function generation, and relaxed alias checking.  Loop
optimization doesn't remove a whole lot of code (usually) and inline
intrinsic generation trades larger code size for speed.  Thus one might
expect the code size to increase with the -Ox switch.

There are some problems with inline intrinsic function generation as
illustrated by the following sample:


/* cl -c  -Fc -G2  -Zl -Zi -K test.c */

good()
{
	unsigned i, r;
	char *s;
	
	r = strlen(s); 		/* works ok */
	r = 43 * strlen(s); 	/* works ok */
	r = strlen(s)/40; 	/* works ok */
}


bad()
{
	unsigned i, r, k;
	char *s;
	
	r = 80/strlen(s); 	/* compiler loops (hangs) */
	r = 43 * 80/strlen(s); 	/* "Compiler Internal Error" */
	r = strlen(s)/strlen(s); /* "Compiler Internal Error " */
	r = i/strlen(s);	/* "Compiler Internal Error" */
}

------------

	outp(port, a ? b : c);   also gives an Internal Compiler Error under
conditions.

Use of intermediate variables or disabling inline generation works
around these bugs.


>
>I don't really like the integrated environments, my main concern is
>compile speed and program performance.   I also did not compile
>for debug under any compiler:  this is the main benefit of QCC over
>Turbo.  No doubt this would have increased the compile time.
>
>Note:  You are almost GUARANTEED not to get the same results I did (timewise,
>       anyway), because I have a weird configuration.  I have a XT clone with
>       an 80286 accelerator card, and a Megabyte of disk cache (EMS).  I
>       made sure the disk cache was flushed before each run to make sure
>       that this did not effect the results (Turbo C ran even FASTER when
>       I didn't do this).