Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/06/05 19:13
Read: times


 
#91132 - you can not align when ...
Responding to: ???'s previous message
alignment/byte ordering are critical considerations just about whenever two systems that do not honor the same conventions are communicating, regardless of whether they are 8-bit microcontrollers, 64-bit workstations, or anything in between.

Whatever the argument, if "ALIGN" is used in a struct, without the rule below applied, that struct can not be transmitted. Whether and where ALIGN stick byte(s) in the struct or not depend totally on what comes before the struct (add a byte variable and the base address of the struct changes). Thus if the sender is changed, the receiver will be screwed up and vv)

I have seen "strange happenings" as a result of align when more than one system was involved so ALIGN should be used with extreme care - or not at all - if a struct is to be communicated.

A good rule:
If any form of align is used in a struct an align statement of the highest order used in the struct shall precede the struct.

That way a struct will not change for "external" reasons.

Erik

List of 13 messages in thread
TopicAuthorDate
alignment of variable in c            01/01/70 00:00      
   Modulo 16            01/01/70 00:00      
      thanks smith            01/01/70 00:00      
      Addressing            01/01/70 00:00      
   Not relevant to 8051            01/01/70 00:00      
      re not relevant            01/01/70 00:00      
      This subject could be relevant....            01/01/70 00:00      
         yeah right            01/01/70 00:00      
         External Influences            01/01/70 00:00      
            Alignment/byte ordering matters a lot!            01/01/70 00:00      
               you can not align when ...            01/01/70 00:00      
                  good references            01/01/70 00:00      
                     RTFM!            01/01/70 00:00      

Back to Subject List