Peter N Lewis wrote:
The biggest challenges I'm facing are:
Lack of univ parameter support (I see Sun Workshop Compiler docs http://www.ictp.trieste.it/~manuals/programming/sun/pascal/lang_ref/ref_proghead.doc.html#742, so it is not just Mac Pascals).
At first glance, it seems to be different. AFAIUI, the Mac Pascal version requires the same size for the parameter. This page says:
: univ is most often used for passing arrays, where you can call a : procedure or function with different array sizes. In that case, : you generally would pass another parameter that gives the actual : size of the array, as follows:
I.e., obviously not the same size. The example is about a var-parameter (where internally a pointer is passed, so in this regard the size is the same), but it doesn't seem to say that the statement applies only to var-parameters.
BTW, I think the example is pretty bad anyway. Why "convert" (by using univ) a variable-size array to 1..100? When the actual parameter is larger, the code would fail with a spurious range-check error. If they want to allow for variable array sizes, they should have used a conformant array parameter, which according to this page, this compiler supports as well. And, given the example as it is written, wouldn't the compiler allow for any type for the actual parameter (not only array [1 .. something] of real)? This would be really bogus.
Anyway, implementing it for different-size value parameters would be hazardous AFAICT, and I can't imagine anybody really wants this.
So what do you really need? I think defining a sane subset might be the only way out of this long-standing dilemma. Types that happen to have the same size on a given platform, e.g. a pointer and some integer type, seem too fragile, and I can't easily imagine a good use for such conversions. OTOH, all pointer types (in GPC) always have the same size, so converting between pointers would be less risky, and more meaningful. Is this sufficient? What kinds of parameters are required, only value, or also var paremeters?
And if we could restrict it to pointers, do I get it right that the routine externally behaves as if the parameter were an untyped pointer (i.e., `Pointer' in BP and GPC), and internally the pointer is converted to the given type before the routine starts?
Lack of {$unused( param )} directive - needs to be commended out with ifdef __GPC__ for each one (and then I don't understand why GPC is not itself warning about the unused parameters...)
Nomally it does with -Wunused-parameters (or -Wall which includes it). Did you use this option? If so, can you provide an example?
Frank