Click here to Skip to main content
15,889,216 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Member Function Pin
Abhi Lahare12-Jul-06 2:28
Abhi Lahare12-Jul-06 2:28 
GeneralRe: Member Function Pin
ashish dogra12-Jul-06 2:37
ashish dogra12-Jul-06 2:37 
GeneralRe: Member Function Pin
Kharfax12-Jul-06 2:48
Kharfax12-Jul-06 2:48 
GeneralRe: Member Function Pin
ashish dogra12-Jul-06 2:52
ashish dogra12-Jul-06 2:52 
GeneralRe: Member Function Pin
David Crow12-Jul-06 2:57
David Crow12-Jul-06 2:57 
GeneralRe: Member Function Pin
Zac Howland12-Jul-06 3:59
Zac Howland12-Jul-06 3:59 
QuestionCSingleLock Assertion Failed Pin
mcgmil12-Jul-06 2:19
mcgmil12-Jul-06 2:19 
QuestionRe: CSingleLock Assertion Failed Pin
David Crow12-Jul-06 2:44
David Crow12-Jul-06 2:44 
AnswerRe: CSingleLock Assertion Failed [modified] Pin
o.sanchez12-Jul-06 2:50
o.sanchez12-Jul-06 2:50 
GeneralRe: CSingleLock Assertion Failed Pin
mcgmil12-Jul-06 5:37
mcgmil12-Jul-06 5:37 
GeneralRe: CSingleLock Assertion Failed Pin
o.sanchez12-Jul-06 20:59
o.sanchez12-Jul-06 20:59 
QuestionAuto UnInstall after specified time Pin
raj_all7912-Jul-06 2:00
raj_all7912-Jul-06 2:00 
AnswerRe: Auto UnInstall after specified time Pin
Jonathan [Darka]12-Jul-06 2:10
professionalJonathan [Darka]12-Jul-06 2:10 
AnswerRe: Auto UnInstall after specified time Pin
David Crow12-Jul-06 2:48
David Crow12-Jul-06 2:48 
AnswerRe: Auto UnInstall after specified time Pin
*Dreamz12-Jul-06 3:21
*Dreamz12-Jul-06 3:21 
Questionvideo ram Pin
samira forooghi12-Jul-06 1:55
samira forooghi12-Jul-06 1:55 
AnswerRe: video ram Pin
includeh1012-Jul-06 2:48
includeh1012-Jul-06 2:48 
QuestionRe: video ram Pin
David Crow12-Jul-06 2:54
David Crow12-Jul-06 2:54 
AnswerRe: video ram Pin
Hamid_RT12-Jul-06 3:21
Hamid_RT12-Jul-06 3:21 
Questionsame structure behave differntly in different application Pin
pavan105nagarbhavi12-Jul-06 1:48
pavan105nagarbhavi12-Jul-06 1:48 
AnswerRe: same structure behave differntly in different application Pin
_AnsHUMAN_ 12-Jul-06 2:16
_AnsHUMAN_ 12-Jul-06 2:16 
QuestionRe: same structure behave differntly in different application Pin
David Crow12-Jul-06 2:59
David Crow12-Jul-06 2:59 
AnswerRe: same structure behave differntly in different application Pin
Zac Howland12-Jul-06 3:41
Zac Howland12-Jul-06 3:41 
pavan105nagarbhavi wrote:
struct lat_lon1 {
char news;
short deg;
short min;
float sec;
}lat;


With the default compiler switches/directives, this structure will be packed as follows:

struct lat_lon1 
{
	char news;	// 1 byte
	char junk1;	// 1 byte
	short deg;	// 2 bytes and must be on 2-byte boundary
	short min;	// 2 bytes and must be on 2-byte boundary
	short junk2;	// 2 bytes and must be on a 2-byte boundary
	float sec;	// 4 bytes and must be on a 4-byte boundary
}lat;


That is where you get the sizeof(lat_lon1) == 12 from. Now, with some varying directives (#pragma pack for example), you could get it packed as follows:

struct lat_lon1 
{
	float sec;	// 4 bytes and must be on a 4-byte boundary
	char news;	// 1 byte
	char junk1;	// 1 byte
	short deg;	// 2 bytes and must be on 2-byte boundary
	short min;	// 2 bytes and must be on 2-byte boundary
}lat;


which would give you sizeof(lat_lon1) == 10. This is a very good example of why it is important to declare variables in a certain order for complex types.

If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week

Zac
QuestionRegistry - RegSetValuEx - Returning Access denied ?? Pin
elitecodex12-Jul-06 1:43
elitecodex12-Jul-06 1:43 
AnswerRe: Registry - RegSetValuEx - Returning Access denied ?? Pin
Steve S12-Jul-06 3:11
Steve S12-Jul-06 3:11 

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.