Click here to Skip to main content
15,909,939 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Serialization question Pin
markkuk14-Jun-01 20:46
markkuk14-Jun-01 20:46 
Questionhow to set the IP address during programming Pin
14-Jun-01 3:07
suss14-Jun-01 3:07 
AnswerRe: how to set the IP address during programming Pin
Carlos Antollini14-Jun-01 4:26
Carlos Antollini14-Jun-01 4:26 
AnswerRe: it's tough! Pin
Masaaki Onishi14-Jun-01 6:55
Masaaki Onishi14-Jun-01 6:55 
GeneralRe: it's tough! Pin
15-Jun-01 1:53
suss15-Jun-01 1:53 
GeneralRe: it's tough! Pin
Masaaki Onishi15-Jun-01 3:59
Masaaki Onishi15-Jun-01 3:59 
GeneralCompare structures Pin
User 665814-Jun-01 1:36
User 665814-Jun-01 1:36 
GeneralRe: Compare structures Pin
Monty14-Jun-01 2:15
Monty14-Jun-01 2:15 
Assuming you're using C, not C++...

If the structure doesn't contain pointers, you can use

if( memcmp( &struct1, &struct2, sizeof( mystruct_t ) ) )
{
// different
}
else
{
// identical
}

This is fast, but assumes that a byte-by-byte comparison is valid (e.g. that padding elements will always match).

If there are pointers, you may wish to check the data they point to, instead of the pointer values themselves.
If you have nested structures containing pointers, this can get quite messy.

In C++, each data type can check for identicallity itself, so there's no problem.
GeneralRe: Compare structures Pin
Bryan Pietrzak14-Jun-01 12:16
Bryan Pietrzak14-Jun-01 12:16 
GeneralRe: Compare structures Pin
Monty14-Jun-01 20:48
Monty14-Jun-01 20:48 
GeneralRe: Compare structures Pin
Bryan Pietrzak15-Jun-01 3:59
Bryan Pietrzak15-Jun-01 3:59 
GeneralCListCtrl tooltips behind the dialog box Pin
Monty14-Jun-01 1:31
Monty14-Jun-01 1:31 
GeneralRe: CListCtrl tooltips behind the dialog box Pin
Tomasz Sowinski14-Jun-01 2:02
Tomasz Sowinski14-Jun-01 2:02 
GeneralThanks. How to stop dialog losing focus? Pin
Monty14-Jun-01 2:27
Monty14-Jun-01 2:27 
GeneralGot it sorted... Pin
Monty14-Jun-01 3:00
Monty14-Jun-01 3:00 
GeneralTestPrint page Pin
ThomasKennedyBose14-Jun-01 0:58
ThomasKennedyBose14-Jun-01 0:58 
GeneralProblem with Device Manager Property Page Pin
DB13-Jun-01 22:48
DB13-Jun-01 22:48 
Generalactivex + dll problem Pin
13-Jun-01 22:28
suss13-Jun-01 22:28 
GeneralRe: activex + dll problem Pin
DVryce12-Jul-01 2:54
DVryce12-Jul-01 2:54 
GeneralCListCtrl Pin
sankar13-Jun-01 21:32
sankar13-Jun-01 21:32 
GeneralRe: CListCtrl Pin
Leo Davidson14-Jun-01 7:21
Leo Davidson14-Jun-01 7:21 
GeneralFaxing Pin
ThomasKennedyBose13-Jun-01 18:22
ThomasKennedyBose13-Jun-01 18:22 
GeneralPatching Pin
Cabadam13-Jun-01 16:22
Cabadam13-Jun-01 16:22 
GeneralRe: Patching Pin
Peter Pearson14-Jun-01 3:18
Peter Pearson14-Jun-01 3:18 
GeneralRe: Patching Pin
Cabadam14-Jun-01 10:35
Cabadam14-Jun-01 10:35 

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.