[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] Skum struct.



"Søren H. Sørensen" wrote:
> 
> Jeg har fulgt debatten om "skum struct" og så allerede i sidste vecka,
> at der var fejl i alle beregninger. En intelligent compiler til en
> computer med adressering i words i stedet for bytes, vil alligne alle
> variable til lige (even) adresser. En int er desuden ikke 4 bytes, men
> bare 2 bytes lang (4 bytes ville være en "long").
> 
> Her er min beregning, med "+1" alle de steder, hvor compileren vil
> alligne til "even address":
> 
> typedef struct {        /* Callsign structure used in info  */
> 
>   char callsign[7]   ;
>   char ssid          ;
> 
> } indicat            ;
> 
> typedef struct {
> 
>   indicat  indic     ;  /* 8   Callsign                     */    8
>   indicat  relai[8]  ;  /* 64  Digis path                   */    64
>   int     lastmes   ;  /* 4   Last L number                */     2
>   int     nbcon     ;  /* 4   Number of connexions         */     2
>   int     hcon      ;  /* 4   Last connexion date          */     2
>   int     lastyap   ;  /* 4   Last YN date                 */     2
>   ushort flags     ;  /* 2   Flags                        */      1 +1
>   ushort on_base   ;  /* 2   ON Base number               */      1 +1
>   uchar    nbl       ;  /* 1   Lines paging                 */    1 +1
>   uchar    lang      ;  /* 1   Language                     */    1 +1
>   int     newbanner ;  /* 4   Date of new banner (lang.NEW)*/     2
>   ushort   download  ;  /* 2   Download size in KB          */    1 +1
>   char     free[20]  ;  /* 20  Reserved                     */    20
>   char     thema     ;  /* 1   Current thema selection      */    1 +1
>   char     nom[18]   ;  /* 18  1st Name                     */    18
>   char     prenom[13];  /* 13  Christian name               */    13 +1
>   char     adres[61] ;  /* 61  Address                      */    61 +1
>   char     ville[31] ;  /* 31  City                         */    31 +1
>   char     teld[13]  ;  /* 13  home phone                   */    13 +1
>   char     telp[13]  ;  /* 13  job phone                    */    13 +1
>   char     home[41]  ;  /* 41  home BBS                     */    41 +1
>   char     qra[7]    ;  /* 7   Qth Locator                  */    7  +1
>   char     priv[13]  ;  /* 13  PRIV directory               */    13 +1
>   char     filtre[7] ;  /* 7   LC choice filter             */    7  +1
>   char     pass[13]  ;  /* 13  Password                     */    13 +1
>   char     zip[9]    ;  /* 9   Zipcode                      */    9  +1
> 
> } info               ;  /* 360 bytes = lenght of one record */
> 
> --------------------------------------------------------------------------
> Iallt                                                             364
> 
> Håber diskussionen slutter her.
> 
> Hälsningar
> Søren H. Sørensen
> CGI-nerd
> 
> Joachim Holst wrote:
> >
> > On tor, 20 maj 1999, you wrote:
> > >Joachim Holst wrote:
> > >>
> > >> Hejsan !
> > >>
> > >> Har enstruct här som bör bli 360 bytes stor. Tyvärr, så påstår min maskin att
> > >> den är 364bytes stor. Har suttit och funderat länge och väl, men kommer inte på
> > >> varför.
> > >
> > >Fordi oversætteren padder med bytes hist og her, for at align'e short og
> > >long, normalt på hhv. addresser delelig med 2 & 4.
> > >
> >
> > Hur löser man problmet då ??
> >
> > Läsa in varje post för sig ??
> >
> > --
> >
> > /Jocke
> >
> > ICQ uin: 3939304
> >
> > ----------------------------------------------------------------
> >
> > ***     Linux..... The choice of a thinking generation     *****
> >
> > ----------------------------------------------------------------


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:07 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *