|
-
Jul 15th, 2001, 04:39 AM
#1
Thread Starter
Hyperactive Member
What does this line of code do?? (easy)
I'm not sure what this does, can anyone help?
cxCaps and cxChar are both integers
Code:
cxCaps = (tm.tmPitchAndFamily & 1 ? 3 : 2) * cxChar / 2;
It's mostly '& 1 ? 3 : 2)' That I don't know the meaning of.
Thanx
Visual Basic 6.0 Enterprise
Visual C++ 6.0 Professional
Wak 
-
Jul 15th, 2001, 05:28 AM
#2
Frenzied Member
Where did you get this code. The absolutely same question was posted by abdul a while ago. Here is the link
-
Jul 15th, 2001, 06:55 AM
#3
Thread Starter
Hyperactive Member
lol... what a coincidence
I got it from a bloke called Charles Petzold. 
Would
Code:
cxCaps = (tm.tmPitchAndFamily & 1 ? 3 : 2) * cxChar / 2;
and
Code:
cxCaps = (tm.tmPitchAndFamily ? 3 : 2) * cxChar / 2;
Do the same thing then?
Visual Basic 6.0 Enterprise
Visual C++ 6.0 Professional
Wak 
-
Jul 15th, 2001, 06:57 AM
#4
Thread Starter
Hyperactive Member
Whoops, I just stared blankly into the screen for 1/2 an hour and it hit me.
Code:
cxCaps = (tm.tmPitchAndFamily & 1 ? 3 : 2) * cxChar / 2;
Is the same as
Code:
cxCaps = ((!tm.tmPitchAndFamily & 0) ? 3 : 2) * cxChar / 2;
I'm not the best @ C++ yet, sorry
Visual Basic 6.0 Enterprise
Visual C++ 6.0 Professional
Wak 
-
Jul 15th, 2001, 01:57 PM
#5
PowerPoster
hi
Yes, I am reading the same book. Is it programming windows 95 or windows 98?
-
Jul 15th, 2001, 04:17 PM
#6
Thread Starter
Hyperactive Member
hi
I dunno, the title is Programming Windows 5th Edition by Charles Petzold
Visual Basic 6.0 Enterprise
Visual C++ 6.0 Professional
Wak 
-
Jul 15th, 2001, 08:55 PM
#7
PowerPoster
The author is giving almost the same examples in his window s programming books.
I am reading "Programming Windows 95"
-
Jul 16th, 2001, 04:16 AM
#8
Thread Starter
Hyperactive Member
grrrrr
I've heard the term 'a lazy programmer is a good programmer ' used, but plz. That refers to programming only. Not book writing.
Visual Basic 6.0 Enterprise
Visual C++ 6.0 Professional
Wak 
-
Jul 16th, 2001, 04:31 AM
#9
Monday Morning Lunatic
Does it matter? 
Ternary form is one of the easiest-confused operators - took me a while to learn it (I was still looking up which way round the true and false values went until about a month ago )
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
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
|