Click here to Skip to main content
15,916,398 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Multithreading using _beginthread Pin
Jörgen Sigvardsson10-Dec-03 8:17
Jörgen Sigvardsson10-Dec-03 8:17 
GeneralRe: Multithreading using _beginthread Pin
Gary R. Wheeler10-Dec-03 15:11
Gary R. Wheeler10-Dec-03 15:11 
GeneralRe: Multithreading using _beginthread Pin
David Crow11-Dec-03 2:31
David Crow11-Dec-03 2:31 
GeneralRe: Multithreading using _beginthread Pin
Gary R. Wheeler11-Dec-03 10:21
Gary R. Wheeler11-Dec-03 10:21 
GeneralRe: Multithreading using _beginthread Pin
David Crow11-Dec-03 10:24
David Crow11-Dec-03 10:24 
General(int() function vs (int) cast - comments please Pin
FearlessBurner10-Dec-03 4:48
FearlessBurner10-Dec-03 4:48 
GeneralRe: (int() function vs (int) cast - comments please Pin
Alexander M.,10-Dec-03 5:25
Alexander M.,10-Dec-03 5:25 
GeneralRe: (int() function vs (int) cast - comments please Pin
Ian Darling10-Dec-03 5:27
Ian Darling10-Dec-03 5:27 
FearlessBurner wrote:
i = (int)f;

Is a cast.

FearlessBurner wrote:
i = int( f );

Constructs an unnamed (temporary) int, using f as the initialiser value, and assigns/copies the value to i. Your compiler probably optimises this.

FearlessBurner wrote:
dbl = double( i );

Is similar to the previous comment, and constructs a temporary unnamed double.


FearlessBurner wrote:
Does anyone know when it became possible to write the code like this, as opposed to using casts?
Does anyone know if there are any drawbacks or using this approach?


It probably became possible to write this when you changed from C to C++.

My own recommendation is to cast using the C++ casts, instead of the C casts, so for the example above I'd write:

i = static_cast<int> (f);

Because it's easier to find casts that use the C++ syntax for casts over the C syntax, and using the correct C++ cast can reduce or highlight potential errors caused by casting - this particularly applies to the other three C++ casts (const_cast, dynamic_cast, and reinterpret_cast)

--
Ian Darling
"The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
GeneralScrollbar in listctrl Pin
super10-Dec-03 3:35
professionalsuper10-Dec-03 3:35 
GeneralRe: Scrollbar in listctrl Pin
David Crow10-Dec-03 7:56
David Crow10-Dec-03 7:56 
GeneralLoadImage returns handle instead of NULL Pin
mexicanchili10-Dec-03 3:27
mexicanchili10-Dec-03 3:27 
GeneralRe: LoadImage returns handle instead of NULL Pin
Alexander M.,10-Dec-03 5:18
Alexander M.,10-Dec-03 5:18 
GeneralRe: LoadImage returns handle instead of NULL Pin
David Crow10-Dec-03 8:06
David Crow10-Dec-03 8:06 
GeneralRe: LoadImage returns handle instead of NULL Pin
Tim Smith10-Dec-03 16:08
Tim Smith10-Dec-03 16:08 
GeneralRe: LoadImage returns handle instead of NULL Pin
mexicanchili11-Dec-03 3:24
mexicanchili11-Dec-03 3:24 
QuestionShould I be using struct instead? Pin
b_girl10-Dec-03 3:23
b_girl10-Dec-03 3:23 
AnswerRe: Should I be using struct instead? Pin
Antti Keskinen10-Dec-03 3:39
Antti Keskinen10-Dec-03 3:39 
GeneralRe: Should I be using struct instead? Pin
b_girl10-Dec-03 4:25
b_girl10-Dec-03 4:25 
GeneralRe: Should I be using struct instead? Pin
Antti Keskinen10-Dec-03 7:43
Antti Keskinen10-Dec-03 7:43 
AnswerRe: Should I be using struct instead? Pin
Navin10-Dec-03 4:49
Navin10-Dec-03 4:49 
GeneralRe: Should I be using struct instead? Pin
b_girl10-Dec-03 5:04
b_girl10-Dec-03 5:04 
GeneralRe: Should I be using struct instead? Pin
Big Art10-Dec-03 6:02
Big Art10-Dec-03 6:02 
GeneralRe: Should I be using struct instead? Pin
b_girl10-Dec-03 6:10
b_girl10-Dec-03 6:10 
QuestionHow to interpret Call stack window message ? Pin
Deepak Samuel10-Dec-03 2:35
Deepak Samuel10-Dec-03 2:35 
AnswerRe: How to interpret Call stack window message ? Pin
Mike Dimmick10-Dec-03 2:41
Mike Dimmick10-Dec-03 2:41 

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.