Click here to Skip to main content
15,886,873 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to pass value to MFC exe Pin
maharaja pandian17-Jul-06 19:28
maharaja pandian17-Jul-06 19:28 
QuestionRe: how to pass value to MFC exe Pin
David Crow18-Jul-06 2:36
David Crow18-Jul-06 2:36 
AnswerRe: how to pass value to MFC exe Pin
William.Wang17-Jul-06 16:20
William.Wang17-Jul-06 16:20 
GeneralRe: how to pass value to MFC exe Pin
maharaja pandian17-Jul-06 19:29
maharaja pandian17-Jul-06 19:29 
Questionhow to pass value to MFC exe from a dll Pin
maharaja pandian17-Jul-06 5:59
maharaja pandian17-Jul-06 5:59 
AnswerRe: how to pass value to MFC exe from a dll Pin
led mike17-Jul-06 7:12
led mike17-Jul-06 7:12 
QuestionAnimateWindow with controls on window Pin
hell_admin17-Jul-06 5:11
hell_admin17-Jul-06 5:11 
GeneralC++ style casting Pin
Rob Caldecott17-Jul-06 5:11
Rob Caldecott17-Jul-06 5:11 
Query. Most people from a C background would cast using the x = (type)y; syntax - for example, to convert a long to a short (knowing it won't be truncated of course...):

long aLong = 1234L;
short aShort = (short)aLong;


No problems.

However, I have come across some C++ code that uses the following syntax:

long aLong = 1234L;
short aShort = short(aLong);


Is this alternative syntax C++ only (I assume it is, but a Google seems to come back with conflcting results)? Also, is there any real advantage to either method? Are the various C++ casts (static_cast, dynamic_cast) more useful in casting POD types like this?

I can't believe I haven't come across the x = type(y); syntax before. I asked some other C/C++ old-timers here and they hadn't seen it either. Mad. Always something new to learn!

GeneralRe: C++ style casting Pin
toxcct17-Jul-06 5:25
toxcct17-Jul-06 5:25 
GeneralRe: C++ style casting Pin
David Crow17-Jul-06 5:25
David Crow17-Jul-06 5:25 
GeneralRe: C++ style casting Pin
Nemanja Trifunovic17-Jul-06 5:35
Nemanja Trifunovic17-Jul-06 5:35 
GeneralRe: C++ style casting Pin
Rob Caldecott17-Jul-06 6:09
Rob Caldecott17-Jul-06 6:09 
GeneralRe: C++ style casting [modified] Pin
ricecake17-Jul-06 11:15
ricecake17-Jul-06 11:15 
GeneralRe: C++ style casting Pin
David Crow17-Jul-06 6:54
David Crow17-Jul-06 6:54 
GeneralRe: C++ style casting Pin
David Crow18-Jul-06 2:48
David Crow18-Jul-06 2:48 
GeneralRe: C++ style casting Pin
Stephen Hewitt17-Jul-06 14:15
Stephen Hewitt17-Jul-06 14:15 
GeneralRe: C++ style casting Pin
David Crow18-Jul-06 2:46
David Crow18-Jul-06 2:46 
GeneralRe: C++ style casting Pin
Stephen Hewitt18-Jul-06 3:58
Stephen Hewitt18-Jul-06 3:58 
GeneralRe: C++ style casting Pin
Maximilien17-Jul-06 5:36
Maximilien17-Jul-06 5:36 
GeneralRe: C++ style casting Pin
toxcct17-Jul-06 5:37
toxcct17-Jul-06 5:37 
GeneralRe: C++ style casting Pin
Maximilien17-Jul-06 6:31
Maximilien17-Jul-06 6:31 
GeneralRe: C++ style casting Pin
David Crow17-Jul-06 6:51
David Crow17-Jul-06 6:51 
GeneralRe: C++ style casting Pin
Jörgen Sigvardsson17-Jul-06 9:03
Jörgen Sigvardsson17-Jul-06 9:03 
GeneralRe: C++ style casting Pin
Zac Howland17-Jul-06 9:49
Zac Howland17-Jul-06 9:49 
GeneralRe: C++ style casting Pin
Stephen Hewitt17-Jul-06 14:16
Stephen Hewitt17-Jul-06 14:16 

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.