Click here to Skip to main content
15,917,795 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralUnion question Pin
Steve Messer3-Nov-04 9:18
Steve Messer3-Nov-04 9:18 
GeneralRe: Union question Pin
David Crow3-Nov-04 9:38
David Crow3-Nov-04 9:38 
GeneralRe: Union question Pin
Steve Messer3-Nov-04 9:45
Steve Messer3-Nov-04 9:45 
GeneralRe: Union question Pin
Henry miller3-Nov-04 10:32
Henry miller3-Nov-04 10:32 
GeneralRe: Union question Pin
Joaquín M López Muñoz3-Nov-04 10:06
Joaquín M López Muñoz3-Nov-04 10:06 
GeneralRe: Union question Pin
Steve Messer3-Nov-04 10:18
Steve Messer3-Nov-04 10:18 
GeneralRe: Union question[modified] Pin
Antony M Kancidrowski4-Nov-04 2:24
Antony M Kancidrowski4-Nov-04 2:24 
GeneralRe: Union question Pin
Steve Messer4-Nov-04 3:42
Steve Messer4-Nov-04 3:42 
Actually here is the actual struct

typedef struct  
{ 
    union 
    { 
        unsigned int field; 
        struct 
        { 
                unsigned xyz_offset:                            1; 
                unsigned collision_fwd_fuselage:                1; 
                unsigned collision_aft_fuselage:                1; 
                unsigned collision_lt_wing:                     1; 
                unsigned collision_rt_wing:                     1; 
                unsigned collision_lt_tail:                     1; 
                unsigned collision_rt_tail:                     1; 
                unsigned collision_vt_tail:                     1; 
                unsigned collision_lt_gear:                     1; 
                unsigned collision_rt_gear:                     1; 
                unsigned collision_nose_gear:                   1; 
                unsigned collision_prop1:                       1; 
                unsigned collision_prop2:                       1; 
                unsigned collision_prop3:                       1; 
                unsigned collision_prop4:                       1; 
                unsigned weapon_strike:                         1; 
                unsigned space:                                16; 
        }; 
    }; 
}CollisionType;




Yes, I wanted to get x,y, and z.


I think you would do it like this:

For example:

if( mystruct.x )
{
   do_x_stuff();
}

if( mystruct.y )
{
   do_y_stuff();
}

if( mystruct.z )
{
   do_z_stuff();
}


Since each bit is either on or off I believe this would work.
Questionis there platform-independent FillMemory function in C/C++!? Pin
clayman873-Nov-04 9:04
clayman873-Nov-04 9:04 
AnswerRe: is there platform-independent FillMemory function in C/C++!? Pin
Joaquín M López Muñoz3-Nov-04 9:15
Joaquín M López Muñoz3-Nov-04 9:15 
AnswerRe: is there platform-independent FillMemory function in C/C++!? Pin
Rick York3-Nov-04 9:15
mveRick York3-Nov-04 9:15 
GeneralRe: is there platform-independent FillMemory function in C/C++!? Pin
clayman873-Nov-04 10:13
clayman873-Nov-04 10:13 
GeneralRe: is there platform-independent FillMemory function in C/C++!? Pin
Joaquín M López Muñoz3-Nov-04 11:02
Joaquín M López Muñoz3-Nov-04 11:02 
GeneralRe: is there platform-independent FillMemory function in C/C++!? Pin
clayman873-Nov-04 10:34
clayman873-Nov-04 10:34 
GeneralRe: is there platform-independent FillMemory function in C/C++!? Pin
Joaquín M López Muñoz3-Nov-04 11:06
Joaquín M López Muñoz3-Nov-04 11:06 
QuestionThe fastest bitmap blitting software? Pin
KellyR3-Nov-04 8:55
KellyR3-Nov-04 8:55 
AnswerRe: The fastest bitmap blitting software? Pin
ThatsAlok3-Nov-04 22:23
ThatsAlok3-Nov-04 22:23 
QuestionTwo files are the same? Pin
peterchen3-Nov-04 8:14
peterchen3-Nov-04 8:14 
AnswerRe: Two files are the same? Pin
Joaquín M López Muñoz3-Nov-04 8:33
Joaquín M López Muñoz3-Nov-04 8:33 
AnswerRe: Two files are the same? Pin
David Crow3-Nov-04 9:01
David Crow3-Nov-04 9:01 
GeneralCSplitterWnd Tab Views Pin
asv3-Nov-04 7:26
asv3-Nov-04 7:26 
GeneralHELP strange thread termination Pin
Vladimir Dubovoy3-Nov-04 7:14
Vladimir Dubovoy3-Nov-04 7:14 
GeneralRe: HELP strange thread termination Pin
Joaquín M López Muñoz3-Nov-04 8:05
Joaquín M López Muñoz3-Nov-04 8:05 
GeneralRe: HELP strange thread termination Pin
Vladimir Dubovoy5-Nov-04 3:49
Vladimir Dubovoy5-Nov-04 3:49 
GeneralWindows Message Question Pin
Tom Wright3-Nov-04 6:54
Tom Wright3-Nov-04 6:54 

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.