Click here to Skip to main content
15,915,833 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: DAO and ADO in same project Pin
MK7818-May-05 23:59
MK7818-May-05 23:59 
GeneralRe: DAO and ADO in same project Pin
RChin19-May-05 0:22
RChin19-May-05 0:22 
GeneralRe: DAO and ADO in same project Pin
MK7819-May-05 1:47
MK7819-May-05 1:47 
GeneralProblems with a dll Pin
JaVinci18-May-05 22:27
JaVinci18-May-05 22:27 
GeneralRe: Problems with a dll Pin
GDavy19-May-05 0:00
GDavy19-May-05 0:00 
GeneralRe: Problems with a dll Pin
JaVinci19-May-05 3:50
JaVinci19-May-05 3:50 
QuestionWhat is #pragma pack()? Pin
xSoptik18-May-05 21:31
xSoptik18-May-05 21:31 
AnswerRe: What is #pragma pack()? Pin
Stlan18-May-05 22:06
Stlan18-May-05 22:06 
Perhaps a simple example is better than any explanation.
First case:

#pragma pack(1)<br />
struct MyStruct<br />
{<br />
BYTE a;<br />
UINT b;<br />
};<br />
#pragma pack()


sizeof(struct MyStruct) will return 5 bytes (1+4=5)

Second case:

#pragma pack(4)<br />
struct MyStruct<br />
{<br />
BYTE a;<br />
UINT b;<br />
};<br />
#pragma pack()


sizeof(struct MyStruct) will now return 8 bytes! (1+3+4=8) because the compiler aligns each member of MyStruct to a 4 bytes boundary. Concretly, the directive tells the compiler that the address of each member must be divisible by 4. To do that, the compiler insert the necessary blank bytes between variable members.
GeneralRe: What is #pragma pack()? Pin
xSoptik19-May-05 1:14
xSoptik19-May-05 1:14 
GeneralGrid controls with sliders and spin controls Pin
surfdabbler18-May-05 21:15
surfdabbler18-May-05 21:15 
GeneralCommunication Pin
usmanmir18-May-05 20:43
usmanmir18-May-05 20:43 
GeneralRe: Communication Pin
toxcct18-May-05 20:49
toxcct18-May-05 20:49 
GeneralRe: Communication Pin
usmanmir18-May-05 21:04
usmanmir18-May-05 21:04 
GeneralRe: Communication Pin
RChin18-May-05 21:31
RChin18-May-05 21:31 
GeneralRe: Communication Pin
Joel Holdsworth19-May-05 0:54
Joel Holdsworth19-May-05 0:54 
GeneralRe: Communication Pin
jmkhael19-May-05 2:13
jmkhael19-May-05 2:13 
GeneralRe: Communication Pin
Noro Korny19-May-05 2:30
Noro Korny19-May-05 2:30 
GeneralRe: Communication Pin
Paul Watson19-May-05 1:33
sitebuilderPaul Watson19-May-05 1:33 
GeneralRe: Communication Pin
ThatsAlok19-May-05 1:40
ThatsAlok19-May-05 1:40 
GeneralRe: Communication Pin
Anonymous19-May-05 1:48
Anonymous19-May-05 1:48 
GeneralRe: Communication Pin
Bob Stanneveld19-May-05 1:50
Bob Stanneveld19-May-05 1:50 
GeneralRe: Communication Pin
ThatsAlok19-May-05 2:32
ThatsAlok19-May-05 2:32 
GeneralRe: Communication Pin
usmanmir19-May-05 17:13
usmanmir19-May-05 17:13 
GeneralRe: Communication Pin
Bob Stanneveld20-May-05 9:48
Bob Stanneveld20-May-05 9:48 
GeneralRe: Communication Pin
El Corazon19-May-05 3:59
El Corazon19-May-05 3:59 

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.