Monday, May 25, 2020

FreeDOS I16GCC vs WATCOM-C

This post, referring to two very different C-compilers, feels a little unfair. However, we are not comparing a commercial product with a hobbyist product eihter.

On my low powered ACER Aspire ONE I compiled the program listed below with both compilers...
No, I am not writing about the result, I want to encourage you to find out yourself which compiler will suite your needs.

Here is the code of my test program:

#include <stdio.h>
#include <stdlib.h>
int main(void)
{
  unsigned long int i,h[20];
  int rnd;
  srand(43558);
  for (i=0;h[i]=0,i<19;i++);
  for (i=0; i<10000000; i++){
    rnd=rand()%20;
    h[rnd]++;
    if(i%10000==0)printf(".");
  }
  printf("\n");
  for(i=0;printf("count of [%02ld] is %ld\n",i,h[i]),i<19;i++);
  return 0;
}

As you see, this is very simple code...
Test the compilers yourself, and you will see which one wins...