[comp.sys.amiga] More about PDC

U613042@HNYKUN11.BITNET (Olaf Seibert) (12/10/87)

[ line ]

The PD C compiler has some slight bugs and
'unimplemented features'. To summarize the ones I found the last 3 days:

- If you use a switch statement with a 'default' case, the instructions
  for that case won't be optimized. This is incorrect and won't work.
  If you turn off the optimization, this problem is no more there, but
  code quality degrades badly. <I mentioned this before>
- It passes arguments to functions in a slightly non-standard way.
  Non-constant short/char expressions are not extended to integers, but passed
  as shorts (2 bytes). The function expects short and char arguments this
  way.
  On the other hand, CONSTANT short/char expressions are cast to ints (4 bytes)
  as they should be. (They always are, anyway).
. This may confuse the called function, however.
  Note that Jeff Lydiatt (the porter) notices problems here but
  just got is backwards.
- Subtraction of pointers is not implemented.
  As soon as the parser sees a pointer, it assumes the number to be
  added/subtracted is an integer. If that really is a pointer, it
  starts doing funny things.
  Try the following program:
  main()

      int i; char c1, c2;
      i = &c2 - &c1;

  Note that this crashes Manx 3.4a (but not 3.4b) with a division by zero.
- Ints are fairly hardcoded to be longs. I would like this to be user-
  selectable with a command line option (or maybe even a #pragma),
  but this is something that I should be able to do myself.
- sizeof(variable) is not implemented. The compiler never says it is,
  however, and sizeof(type) works.
- I am sure more bugs will turn up as I (and others) look more closely to the
  thing.
  In its defense can be said that when it produces correct code, which
  it does most of the time, it is better than the code generated by
  the Manx compiler (don't know about the current Lattice code quality).

Maybe more later....
---
The opinions possibly reflected herein are my own, and not necessarily
those of someone else I might be connected with. They MAY, however, be.
>>> I *thought* I was living in a free, modern country....
--- Olaf (Rhialto) Seibert...  U613042@HNYKUN11.BITNET
  USEnet is *almost* an anagram of unsent ... BITnet: Because It's There
          Computers? Just say *YES*!  Customs? Just say *NO*!