Results 1 to 3 of 3

Thread: memory alignment and structure padding

  1. #1
    Join Date
    Oct 2009
    Posts
    3

    memory alignment and structure padding

    hi i m wondering what is memory alignment and structure padding i was reading some book on c and got to bitfields structure and talks abt structure padding and its used to align memory i don't even know what's memory alignment means could someone please explain to me there concept ? in details
    thanks in advanced.

  2. #2
    Join Date
    Oct 2005
    Posts
    2,393

    Re: memory alignment and structure padding

    Data structure alignment is the way data is arranged and accessed in computer memory. It consists of two separate but related issues: data alignment and data structure padding. As size of pointer is 4 bytes, if everything is organized by multiple of 4, that it will be easier and faster to calculate the address and processing them. As structures are used to club different size variables, compiler will align to 4 byte boundaries and for that it needs padding. When you are using C, structure padding is used to pad the data in such a way that it can be sent to external devices. Structure Padding is done to do memory alignment.

  3. #3
    Join Date
    May 2008
    Posts
    2,297

    Re: memory alignment and structure padding

    Although the compiler (or interpreter) normally allocates individual data items on aligned boundaries, data structures often have members with different alignment requirements. To maintain proper alignment the translator normally inserts additional unnamed data members so that each member is properly aligned. In addition the data structure as a whole may be padded with a final unnamed member. This allows each member of an array of structures to be properly aligned.

Similar Threads

  1. customize Window Border padding in Windows 8
    By Fella in forum Customize Desktop
    Replies: 4
    Last Post: 21-06-2013, 10:59 AM
  2. What is Structure Padding in C ?
    By avit in forum Software Development
    Replies: 6
    Last Post: 03-05-2012, 12:50 AM
  3. Css padding in html
    By klite in forum Software Development
    Replies: 7
    Last Post: 31-12-2009, 11:00 AM
  4. Html need to know about text wrap padding around an image
    By ComPaCt in forum Software Development
    Replies: 2
    Last Post: 09-07-2009, 08:30 PM
  5. Problem with width for nested div padding
    By Jaisudha in forum Software Development
    Replies: 3
    Last Post: 22-06-2009, 12:28 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,751,342,123.55216 seconds with 16 queries