# Memory alignment at byte.

**URL:** <https://forums.digi.com/t/memory-alignment-at-byte/3640>\
**Category:** NET+OS\
**Tags:** pragma-pack\
**Created:** [February 12, 2009, 1:15pm UTC](https://forums.digi.com/t/memory-alignment-at-byte/3640 "2009-02-12T13:15:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmalaspina](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mmalaspina](https://forums.digi.com/u/mmalaspina)\
**Post date:** [February 12, 2009, 1:15pm UTC](https://forums.digi.com/t/memory-alignment-at-byte/3640/1 "2009-02-12T13:15:19Z")

</div>

Hi everybody,

I need to set the alignment at 1 byte for a particular struct declaration, so I’ve found the following #pragma in the ncc\_post.c file (automatically included in my project):

#pragma alignvar (32)

so I thought to modify and use it writing the following piece of code:

#pragma alignvar (8)  
struct struct\_type a;  
 #pragma alignvar (32)

Unfortunately the compiler logs in the problem window (DIGI ESP for NET+OS v7.4 IDE) that “the directive has been egnored”…

Do you know if there is a way to obtain the desired 1-byte alignment?

Thank you very much,

Maurizio Malaspina

---

<div class="post-metadata">

**Author:** ![michael1](https://avatars.discourse-cdn.com/v4/letter/m/eada6e/32.png) [@michael1](https://forums.digi.com/u/michael1)\
**Post date:** [February 16, 2009, 1:14pm UTC](https://forums.digi.com/t/memory-alignment-at-byte/3640/2 "2009-02-16T13:14:16Z")

</div>

Try

#pragma pack(1)

…

#pragma pack() // back to default
