Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] Re: For C Experts

2006-03-30 by K B Shah-lascaux

My 2 cents...

Many compiler have 
#pragma pack.... 
(I have seen this in Visual Studio ---  as well as in IAR compiler)
directive   Specially used with structures 

You may get issue with the  member of  a structure which is not alighed to BYTE ... specially while using simalr way of copying  data using pointers...

The pragma directive forces structure to pack ... the way to copy data will be always  to use memcpy i.e. byte  by byte copy ... it might be inefficient in case where you are looking for speed ..

I would like to say ewhen some one is using pointers and specially with type cast , person is well awre what he is doing.


K B 
  ----- Original Message ----- 
  From: Ed Koffeman 
  To: lpc2000@yahoogroups.com 
  Sent: Thursday, March 30, 2006 12:07 PM
  Subject: RE: [lpc2000] Re: For C Experts





  If your compiler has the __packed keyword then you could use:

  __packed int *ip;

  ...

      ip = (__packed int *)&buf[i];

  and the compiler should know to treat the alignment carefully.

  But, it's inefficient.

  Ed Koffeman




------------------------------------------------------------------------------
  YAHOO! GROUPS LINKS 

    a..  Visit your group "lpc2000" on the web.
      
    b..  To unsubscribe from this group, send an email to:
     lpc2000-unsubscribe@yahoogroups.com
      
    c..  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 


------------------------------------------------------------------------------




------------------------------------------------------------------------------


  No virus found in this incoming message.
  Checked by AVG Free Edition.
  Version: 7.1.385 / Virus Database: 268.3.3/296 - Release Date: 29/03/2006


[Non-text portions of this message have been removed]

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.