On 18 Nov 2012 at 10:16, Baudouin Le Charlier wrote:
Here is a very simple example where the bus error occurs :
I executed the following commands :
Soeur-Sourire:Cours17 blc$ gp busError.pas Soeur-Sourire:Cours17 blc$ ./busError Bus error Soeur-Sourire:Cours17 blc$
After executing the program, the file toto.pers exists and is empty (Zero bytes).
Apart from the fact that nothing in the record is initialialised, this is the offending statement: case sexe : boolean of true : (nomDeJeuneFille : string80) ; false : (matricule : string10)
What I am about to say may simply expose my ignorance - but I will say it anyway. I am no compiler writer, and I don't use variant records myself - but, from where I am standing, I am at a loss to know what the size of the "personne" record is. "nomDeJeuneFille" and "matricule" are supposed to occupy the same location, but they are not the same size. So what data size is the "file of personne" expecting? Data that will vary in size depending on a value that is not known at compile time? Is this allowed?
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.greatchief.plus.com/