Structure Packing in C

preview_player
Показать описание
C Programming: Structure Packing in C Programming.
Topics discussed:
1) Structure Packing.
2) The need for Structure Packing.

Music:
Axol x Alex Skrindo - You [NCS Release]

#CProgrammingByNeso #CProgramming #StructuresInC #StructurePacking #Structure&Union
Рекомендации по теме
Комментарии
Автор

First view...
I was totally unaware of this concept so thank you neso academy

shashankgaur
Автор

sir please make video for all the subject

VishalMishra-jxgs
Автор

thank you a lot for sharing the knowledge 😊😊

hemasundarkasturi
Автор

sir as in previous example where 12bytes were used and 3cpu cycles then still if we did't used padding then the fisrt char will use 1 byte 2nd int will use next 3 bytes of first word and 1 byte in 2nd word and 3rd char will use 1 byte in 2nd word, total of 2 cycle being used, this is inefficient

oksowhat
Автор

You should still study your target architectures and not take all structure padding as bad ... most modern processor ISA's implement a "barrel shifter" to make fetch and put single cycle operations which based on structure types and order sometimes can't help but have some padding ... Binary packing is another technique to be studied that focuses at the byte shifting .. great for implementing protocols and working within the bounds of CPU caches

johnh
Автор

The teaching about structure in detail is excellent. Can you please explain the #pragma directive in detail

sivaramakrishna
Автор

If I need both and optimise code means! What we have to do. ? Structure should be properly ordering?

veeraloganathanvvs
Автор

First view
First like
First comment❤

Enough for the day ..

Sir please provide videos on data structures .

jeedikantivenkat
Автор

Then what is the size of that var in 62 bites architecture??

varunsaigs
Автор

Great video as always! Your videos save me so much time. Thanks a lot.

joel_b
Автор

Thank you sir, for your knowledge transfer

ankammaraochintala
Автор

Nice one, bur was not as clear as structure padding video. Concern is how processor modulates its data accessing from 8bytes at a time to 6bytes.

vinayakgujjar
Автор

Thank you so much, had no idea that it could be done!

Cat_Sterling
Автор

why not put low byte data types in front of high byte ones when you construct struct

peasant
Автор

But how pragma will work internally?? I want to know about internal process of pragma

gsravan
Автор

What will be the output of this program ??

AamirKhan-dehg
Автор

sir, but In 64 bit architecture 1 word =8 byte so without pragma pack it should be 8 na for char, int, char

tech-helpbuddy
Автор

Sir... Pls update videos in operating system

deviganeshan
Автор

How many wastage of cpu cycles in a above program.

yogeshmhanta
Автор

is it always recommended to pack structures?

suhanibohra