Click here to Skip to main content
15,908,775 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralUnit tests Pin
Ravi Bhavnani21-Jan-05 17:48
professionalRavi Bhavnani21-Jan-05 17:48 
GeneralRe: Unit tests Pin
Bob Ciora21-Jan-05 19:02
Bob Ciora21-Jan-05 19:02 
GeneralRe: Unit tests Pin
Henry miller24-Jan-05 4:47
Henry miller24-Jan-05 4:47 
GeneralRe: Unit tests Pin
Ravi Bhavnani24-Jan-05 5:11
professionalRavi Bhavnani24-Jan-05 5:11 
GeneralConfused with some GDI functions Pin
LiYS21-Jan-05 17:15
LiYS21-Jan-05 17:15 
GeneralRe: Confused with some GDI functions Pin
Bob Ciora21-Jan-05 18:59
Bob Ciora21-Jan-05 18:59 
GeneralRe: Confused with some GDI functions Pin
LiYS21-Jan-05 22:48
LiYS21-Jan-05 22:48 
General#pragma pack(1) packing wrong structure sizes ! ! ! Pin
Alan Chambers21-Jan-05 14:58
Alan Chambers21-Jan-05 14:58 
I return to the windows development community in need of some anger and frustration relieving guidance from you guru's. I have the following code :

<br />
#pragma pack(push, 1)<br />
typedef struct<br />
{<br />
	u16  _id : 10;<br />
	u8   _hflip : 1;<br />
	u8   _vflip : 1;<br />
	u8   _palettetype : 4;<br />
}	MAPDATA;<br />


Correct me if I'm wrong but 10 bits + 1 bit + 1 bit + 4 bits = 16 bits which equates to 2 f**king bytes, yet #pragma pack, push, pop every blinking piece of crap that microsoft has to offer returns 3 bytes when I call sizeof(MAPDATA) ! ! ! If I use #pragma push(2) sizeof then miraculously returns with a 4 byte alignment. This is completely messing up my quantize and save algorithm and I've been up until 2am in the morning trying to figure out why gcc's __attribute__ ((packed)) works like a dream and microsoft's pants #pragma pack counts like an epileptic monkey in a bright multi-coloured jacket.

Thanks all,
and apologies for the frustration.



"When I left you I was but the learner, now I am the master" - Darth Vader
GeneralRe: #pragma pack(1) packing wrong structure sizes ! ! ! Pin
Tim Smith21-Jan-05 15:10
Tim Smith21-Jan-05 15:10 
GeneralRe: #pragma pack(1) packing wrong structure sizes ! ! ! Pin
Alan Chambers21-Jan-05 23:59
Alan Chambers21-Jan-05 23:59 
GeneralRe: #pragma pack(1) packing wrong structure sizes ! ! ! Pin
Alan Chambers28-Jan-05 11:05
Alan Chambers28-Jan-05 11:05 
QuestionHow to use shared-memory to map uncertain page file Pin
shusong21-Jan-05 14:06
shusong21-Jan-05 14:06 
AnswerRe: How to use shared-memory to map uncertain page file Pin
Bob Ciora21-Jan-05 19:47
Bob Ciora21-Jan-05 19:47 
QuestionHow to draw a ListView frame Pin
Björn Eiríksson21-Jan-05 13:25
sussBjörn Eiríksson21-Jan-05 13:25 
QuestionHow to perform qsort on a CList of class objects? Pin
wsquare21-Jan-05 12:51
wsquare21-Jan-05 12:51 
AnswerRe: How to perform qsort on a CList of class objects? Pin
wsquare21-Jan-05 12:56
wsquare21-Jan-05 12:56 
AnswerRe: How to perform qsort on a CList of class objects? Pin
Anonymous21-Jan-05 13:31
Anonymous21-Jan-05 13:31 
AnswerRe: How to perform qsort on a CList of class objects? Pin
Bob Ciora21-Jan-05 18:48
Bob Ciora21-Jan-05 18:48 
GeneralRe: How to perform qsort on a CList of class objects? Pin
wsquare21-Jan-05 19:58
wsquare21-Jan-05 19:58 
GeneralRe: How to perform qsort on a CList of class objects? Pin
markkuk22-Jan-05 0:03
markkuk22-Jan-05 0:03 
GeneralRe: How to perform qsort on a CList of class objects? Pin
Bob Ciora22-Jan-05 3:25
Bob Ciora22-Jan-05 3:25 
GeneralRe: How to perform qsort on a CList of class objects? Pin
markkuk23-Jan-05 4:31
markkuk23-Jan-05 4:31 
GeneralRe: How to perform qsort on a CList of class objects? Pin
Bob Ciora22-Jan-05 4:22
Bob Ciora22-Jan-05 4:22 
QuestionHow do I assign char array address to int? Pin
ErikDabrowsky21-Jan-05 10:26
ErikDabrowsky21-Jan-05 10:26 
AnswerRe: How do I assign char array address to int? Pin
Michael Dunn21-Jan-05 11:00
sitebuilderMichael Dunn21-Jan-05 11:00 

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.