[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] Re: GCC



As has been said, this thread really doesn't belong here, but...

> > I once had to modify a program because PureC (I don't think it was back
> > in the TurboC days) complained about something to do with namespaces.
...
> Interesting. So far I haven't come across a PureC problem which made the
> compiler itself non-ANSI...

Well, this problem (whatever it was exactly) definitely was a violation of
the standard.

> > I also don't like to use C as a 'macro assembler', which is more or less
> > necessary if you want to get decent speed out of PureC compiled code.
> > Take a look at dejanews for my Usenet articles comparing the three
> > compilers mentioned here if you want to see what I mean.
> 
> I am very surprised to hear this. My experience is that PureC code usually
> is smaller and faster because of the parameter passing model.

If you write code that calls lots of small functions that can indeed make
PureC faster than at least GCC (Lattice can pass in registers as well if
you tell it to). On the other hand, if speed is important - why are you
calling a lot of small functions, anyway?
Also, GCC could inline them for you...

The problem with PureC is that it really doesn't optimize at all, though
it's pretty good at register allocation.

The test program I've used in my most recent compiler comparison tests
(I don't think dejanews goes back long enough to find the earlier ones)
is as follows. A seemingly simple program which never the less shows
a _very_ large difference between PureC and Lattice/GCC when it comes
to the code generated.

#define ROWS 25
#define COLS 25

void main(void)
{
        long i, j, k;
        long array[ROWS][COLS];

        for(i = 0; i < ROWS * COLS; i++)
                *((long *)array + i) = 0;

        k = COLS * ROWS;
        for(i = 0; i < ROWS; i++)
                for(j = 0; j < COLS; j++)
                        array[i][j] += i * k;
}


-- 
  Chalmers University   | Why are these |  e-mail:   rand@cd.chalmers.se
     of Technology      |  .signatures  |            johan@rand.thn.htu.se
                        | so hard to do |  WWW/ftp:  rand.thn.htu.se
   Gothenburg, Sweden   |     well?     |            (MGIFv5, QLem, BAD MOOD)