Click here to Skip to main content
15,909,953 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: What does #pragma pack(0) do Pin
Lakamraju Raghuram22-Apr-12 7:47
Lakamraju Raghuram22-Apr-12 7:47 
GeneralRe: What does #pragma pack(0) do Pin
Erudite_Eric22-Apr-12 7:53
Erudite_Eric22-Apr-12 7:53 
GeneralRe: What does #pragma pack(0) do Pin
Lakamraju Raghuram22-Apr-12 8:03
Lakamraju Raghuram22-Apr-12 8:03 
GeneralRe: What does #pragma pack(0) do Pin
Erudite_Eric22-Apr-12 8:12
Erudite_Eric22-Apr-12 8:12 
GeneralRe: What does #pragma pack(0) do Pin
Lakamraju Raghuram22-Apr-12 8:19
Lakamraju Raghuram22-Apr-12 8:19 
GeneralRe: What does #pragma pack(0) do Pin
Erudite_Eric22-Apr-12 22:40
Erudite_Eric22-Apr-12 22:40 
GeneralRe: What does #pragma pack(0) do Pin
yu-jian22-Apr-12 18:01
yu-jian22-Apr-12 18:01 
AnswerRe: What does #pragma pack(0) do Pin
Erudite_Eric22-Apr-12 7:56
Erudite_Eric22-Apr-12 7:56 
#pragme pack 0 takes out all pading between data members in a struct so they are contiguous in memory. Very useful indeed since pretty much every data stream has no padding since it wastes bandwidth so being able to cast a chunk of memory to some zero packed struct gives you immediate and easy access to those data members.

Consider an ethernet framed IP packet containing UDP and DHCP data. You can build a struct to grab the IP address requested directly from the data.


--edit--

Actually I am talking crap. pack (1) makes data member contiguous in memory, pack (0) resets packing. DOh!
==============================

Nothing to say.


modified 23-Apr-12 4:39am.

QuestionRe: What does #pragma pack(0) do PinPopular
CPallini22-Apr-12 10:43
mveCPallini22-Apr-12 10:43 
AnswerRe: What does #pragma pack(0) do Pin
yu-jian22-Apr-12 18:07
yu-jian22-Apr-12 18:07 
GeneralRe: What does #pragma pack(0) do Pin
enhzflep22-Apr-12 18:16
enhzflep22-Apr-12 18:16 
AnswerRe: What does #pragma pack(0) do Pin
Randor 22-Apr-12 11:30
professional Randor 22-Apr-12 11:30 
GeneralRe: What does #pragma pack(0) do Pin
yu-jian22-Apr-12 20:04
yu-jian22-Apr-12 20:04 
GeneralRe: What does #pragma pack(0) do Pin
Richard MacCutchan22-Apr-12 21:09
mveRichard MacCutchan22-Apr-12 21:09 
GeneralRe: What does #pragma pack(0) do Pin
yu-jian23-Apr-12 2:17
yu-jian23-Apr-12 2:17 
AnswerRe: What does #pragma pack(0) do Pin
Aescleal23-Apr-12 7:13
Aescleal23-Apr-12 7:13 
QuestionDialog Proc, Fire a new thread function after intialization Pin
jkirkerx21-Apr-12 11:45
professionaljkirkerx21-Apr-12 11:45 
AnswerFor Now, I changed the way I created the thread. It works and looks clean Pin
jkirkerx21-Apr-12 12:33
professionaljkirkerx21-Apr-12 12:33 
QuestionC++ File Pin
Member 874742521-Apr-12 1:04
Member 874742521-Apr-12 1:04 
AnswerRe: C++ File Pin
Wes Aday21-Apr-12 1:15
professionalWes Aday21-Apr-12 1:15 
AnswerRe: C++ File Pin
Lakamraju Raghuram21-Apr-12 1:16
Lakamraju Raghuram21-Apr-12 1:16 
AnswerRe: C++ File Pin
CPallini21-Apr-12 8:25
mveCPallini21-Apr-12 8:25 
JokeRe: C++ File Pin
Nelek21-Apr-12 14:15
protectorNelek21-Apr-12 14:15 
GeneralRe: C++ File Pin
CPallini21-Apr-12 19:06
mveCPallini21-Apr-12 19:06 
QuestionRe: C++ File Pin
David Crow21-Apr-12 16:27
David Crow21-Apr-12 16:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.