|
-
Apr 5th, 2002, 01:41 AM
#1
Thread Starter
PowerPoster
Wird...
I encounter this in my current development and hope someone can explain more abt it 
Below is a structure that i define in my application. By reference to the MSDN and I get 67 Bytes with reference to the individual data type. But once, i use the sizeof() function, i get 72 bytes. Where the extra 5 bytes come from?
So, in future, should i use the sizeof function? or
PHP Code:
typedef struct tagGPS
{
double TOW; // 8 bytes
double Lat; // 8 bytes
double Lon; // 8 bytes
int Alt; // 4 bytes
int Speed; // 4 bytes
int ClimbRate; // 4 bytes
int WeekNum; // 4 bytes
double Direction; // 8 bytes
int Mode; // 4 bytes
int DOP; // 4 bytes
int NumSat; // 4 bytes
unsigned char Event; // 1 bytes
unsigned short MTUid; // 2 bytes
unsigned short GPIO; // 2 bytes
unsigned short UnitStatus; // 2 bytes
//========
//67 bytes
}GPS;
-
Apr 5th, 2002, 07:45 AM
#2
transcendental analytic
MTUid is aligned after a 3 bytes gap, 2 extra bytes are wasted after UnitStatus, move Event downmost and see if it helps
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Apr 6th, 2002, 08:45 PM
#3
Thread Starter
PowerPoster
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|