Re: Bus error when writing in a typed file
"Prof A Olowofoyeku (The African Chief)" <[email protected]>
| Newsgroups | gmane.comp.compilers.gpc |
|---|---|
| Organization | ChiefSoft |
| Message-ID | <[email protected]> |
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?
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
[email protected]
https://www.g-n-u.de/mailman/listinfo/gpc