Le 18 nov. 2012 à 19:00, Prof A Olowofoyeku (The African Chief) a écrit :
On 18 Nov 2012 at 17:39, Maurice Lombardi wrote:
Le 18/11/2012 16:40, Baudouin Le Charlier a écrit :
The following program is completely equivalent to the previous one but it executes without errors. (Thanks Chief !)
Baudouin Le Charlier
Yes, but this is a workaround, not a solution. The two syntaxes are equally valid in pascal. If I add the instructions
writeln(SizeOf(p)); writeln(SizeOf(f^));
between rewrite(f); and write(f,p)
noBugError answers
772 772
the result expected if the two variants are consecutive
BusError answers only
772
and launches the error. A little experimenting with commenting instructions out shows that the instruction writeln(SizeOf(f^)); alone is enough to launch the interrupt
Perhaps it's a bug in the compiler. The original code compiles and runs okay when compiled with Delphi 7 and Virtual Pascal.
It also runs okay if you declare "sexe" like this; case sexe : boolean of false : (nomDeJeuneFille : string80) ; true : (matricule : string10)
( i.e., false (0) *before* true (1) ). Should the order be significant?
To my knowledge, the constant false and true are pure comments in this construct and they should not be used in any way by the compiler to generate code. The compiler should (at best) only check that they are constant of boolean type and that no repetition of the same constant occurs.
Baudouin
In this case it seems to be - which (depending on the answer to my question) is either a compiler bug, or programmer error. Over to those who know what the standards require ....
Best regards, The Chief
Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.greatchief.plus.com/
Gpc mailing list Gpc@gnu.de https://www.g-n-u.de/mailman/listinfo/gpc