Frank Heckenbach wrote:
Artur Zaroda wrote:
... snip ...
For a somewhat less obvious case try:
program az46(output); (* FLAG --classic-pascal *) begin writeln('failed: ',round(1)) (* WRONG - parameter of "round" should be of real-type *) end.
GNU Pascal issues a warning here; I believe that ISO says it is illegal.
Incidentally, BP accepts this, and BTW, this was the reason why I allowed these things in GPC -- someone did exactly this in a BP program that I should support in GPC. But I'll disable it in CP/EP mode then.
For some peculiar reason my gut would be to go along with BP here. Before changing it let's locate the appropriate passages in 7185 and 10206. It is much like accepting "2 * 2.0" as an expression, where there should be an automatic conversion of the 2. It makes little sense to have:
v := round(1 * 2.0); (* legal *) and v := round(1.0 * 2); (* legal *) yet v := round(1 * 2); (* illegal *)
noting that the real portions may be references to variables, whose type is not immediately obvious.
LATER - I looked them up, and Mr Zaroda is correct. I still feel the expression should either be converted or the function call optimized out. Maybe some grist for the gnu variety. I suggest complaining only with 'pedantic' and generating the appropriate code anyhow. That should minimize the changes.