|
Page 1 of 1 |
SycoShaman
VIP Master Jedi
Posts: 24468
Location: Toronto, Canada
|
Posted: Tue, 29th Mar 2005 16:25 Post subject: C++ help |
|
 |
I dunno if this is in the right section, I apologize if it isnt.
I recently started to learn C++ (dos right now, not mfc). Know vb (somewhat) and internet based languages.
Can anyone give me an example of the Bitwise operators in practical use besides when in relation to hardware programming...like, why would i use the bitwise operators to manipulate individual flags when I can do the same with variables?
I tried to learn assembly, which is not all that complicated, but boring.
If i wanted to manipulate ind. flags, wouldnt it be easier to actually use assembly than bitwise operators?
anyway, any help will be welcome
|
|
Back to top |
|
 |
|
|
Back to top |
|
 |
|
Posted: Sun, 3rd Jul 2005 16:11 Post subject: |
|
 |
Using bits for boolean flags is common because it is a more simpler, more compact and more readable way to specify multiple options than the alternative.
Code: |
::MessageBox(NULL,_T("Hello World"),_T("Message"), MB_OK | MB_ICONEXCLAMATION );
|
is more readable than using a variable for every option:
Code: |
::MessageBox(NULL,_T("Hello World"),_T("Message"), TRUE, FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE);
|
As for using asm, it's not necessary since you can do everything you want wrt bitmasks in C. You really won't need asm at all unless you are optimizing using special instructions like for SIMD etc.
|
|
Back to top |
|
 |
Page 1 of 1 |
All times are GMT + 1 Hour |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB 2.0.8 © 2001, 2002 phpBB Group
|
|
 |
|