Q61558: Unresolved External __CImin Caused by /Gh /Os Compile Options

Article: Q61558
Product(s): See article
Version(s): 6.00   | 6.00
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | buglist6.00 buglist6.00a | mspl13_c
Last Modified: 19-JAN-1991

If you use the min() macro to compare two floating-point numbers and
compile with /Gh (generate old helper function names) and /Os
(optimize for size), the function name "__CImin" is generated by the
compiler. Unfortunately, there is no function by this name in any of
the C version 5.10 or 6.00 libraries.

Code Example
------------

// Compile with /Gh /Os

#include <stdio.h>
#include <stdlib.h>

#define TESTVAL 5.0

void main (int argc, char ** argv)
{
   double dValue;

   if (argc > 1)
   {
      dValue = atof (argv[1]);
      printf ("The lesser of %f and %f is %f\n",
              dValue,
              TESTVAL,
              min (dValue, TESTVAL));
   }
   exit (0);
}

As a workaround, compile without /Os optimization.

Microsoft has confirmed this to be a problem with C versions 6.00 and
6.00a. We are researching this problem and will post new information
here as it becomes available.