[comp.lang.c] Compiler Bugs

mitch@manta.NOSC.MIL (Ray Mitchell) (03/28/91)

This is kind of a collection of items pertaining to ANSI C, Microsoft C, and
Borland C.

I would appreciate it if someone could give me an address, phone number, and
correct document number where I may order the official ANSI C standard.

Borland Bug?

Has anybody found that huge arrays (i.e., 256K) don't work correctly on
Borland's C++?

   This may seem like flame Microsoft and praise Borland but it is not intended
   to be that.  I have noticed three elementary things which the Borland C
   compilers handle properly but Microsoft does not.  Maybe someone else has
   encountered them.

1.
   I noticed that with versions 6.0 and 6.01 of Microsoft C, some of my
   programs which do a lot of far allocing and reallocing run out of memory
   where they didn't on previous versions and don't with Borland.  Upon
   contacting Microsoft, I was told to call some new function in between
   reallocs to free up the memory (I don't recall the function name).  It
   worked, however, the program ran slower by a factor of 10.  They then
   told me to check Compu-Serv for a good memory allocator. ???

2.
   Here's one that produces interesting results with Microsoft 5.0, 5.1, 6.0,
   and 6.01.  The number of characters scanned is supposed to be placed into
   the variable "count".  Depending on what you are actually scanning for, the
   results can be anywhere fron bizarre to almost correct - but never correct.
   Borland handles it properly.

	int value, count;
	sscanf("1", "%d%n", &value, &count);
	printf("%d %d", value, count);

3.
   Here's one that bombs Microsoft 5.0, 5.1, 6.0, and 6.01 at run time.
   Apparently they have overlooked the fact that the type of the conditional
   expression is double, regardless of the outcome.  Maybe, on the other hand,
   the preprocessor has optimized the code into oblivion.
   Borland handles it properly.

	printf("%f", 1 ? 2 : 3.0);