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 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/


_______________________________________________
Gpc mailing list
[email protected]
https://www.g-n-u.de/mailman/listinfo/gpc
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.