Click here to Skip to main content
15,920,513 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: WritePrinter API seems Good but Behave Difficult Pin
AsimUmair28-Oct-05 0:04
AsimUmair28-Oct-05 0:04 
GeneralRe: WritePrinter API seems Good but Behave Difficult Pin
David Crow28-Oct-05 2:15
David Crow28-Oct-05 2:15 
Question(const char*)this == this Pin
WernerPos26-Oct-05 23:58
WernerPos26-Oct-05 23:58 
AnswerRe: (const char*)this == this Pin
cmk27-Oct-05 0:44
cmk27-Oct-05 0:44 
GeneralRe: (const char*)this == this Pin
WernerPos27-Oct-05 1:18
WernerPos27-Oct-05 1:18 
GeneralRe: (const char*)this == this Pin
WernerPos27-Oct-05 1:26
WernerPos27-Oct-05 1:26 
GeneralRe: (const char*)this == this Pin
cmk27-Oct-05 2:02
cmk27-Oct-05 2:02 
GeneralRe: (const char*)this == this Pin
WernerP27-Oct-05 22:11
WernerP27-Oct-05 22:11 
Dear Chris,
I argued with my colleague about this yesterday and thought about it in the evening as well.

I think, the problem actually is, that I wanted an extractor, but I overrode the cast operator instead. I did so because it has often been done in the Windows API (_variant_t, _bstr_t), rather than it had been much convenient to do so.

(1) I can see now, that this is much dangerous because it is syntactically equivalent to an old style cast.

(2) There is also a a point with _variant_t and _bstr_t - Extractors, which I don't like at all. They sound like (char * const) and this doesn't say at all, what it is actually doing. Syntactically they are like functions without a name. I will prefer something like std::string extractor c_str in the future.

(3) I rarely use true casts at all. I had some cases, where type conversions were necessary because I used results from one library as inputs for an other. But I didn't cast there, because this would hide the fact of conversion during compilation. So someone who compiled the program would not be warned and would not check, whether the cast is ok under the circumstances given.



Regards Werner
AnswerRe: (const char*)this == this Pin
BadKarma27-Oct-05 1:41
BadKarma27-Oct-05 1:41 
AnswerRe: (const char*)this == this Pin
BadKarma27-Oct-05 2:34
BadKarma27-Oct-05 2:34 
GeneralRe: (const char*)this == this Pin
WernerP27-Oct-05 22:19
WernerP27-Oct-05 22:19 
GeneralRe: (const char*)this == this Pin
WernerP27-Oct-05 2:42
WernerP27-Oct-05 2:42 
QuestionSwitch views inside ChildFrm Pin
LiYS26-Oct-05 22:38
LiYS26-Oct-05 22:38 
QuestionTruncation Pin
Raza568026-Oct-05 22:33
Raza568026-Oct-05 22:33 
AnswerRe: Truncation Pin
Cedric Moonen26-Oct-05 22:41
Cedric Moonen26-Oct-05 22:41 
AnswerRe: Truncation Pin
kakan27-Oct-05 0:51
professionalkakan27-Oct-05 0:51 
QuestionXp Like ScrollBar in VC++ 6.0 Pin
Neagoe Gabriel26-Oct-05 22:19
Neagoe Gabriel26-Oct-05 22:19 
AnswerRe: Xp Like ScrollBar in VC++ 6.0 Pin
Anonymous27-Oct-05 0:01
Anonymous27-Oct-05 0:01 
Questionwincrypt.h? Pin
adonisv26-Oct-05 20:32
adonisv26-Oct-05 20:32 
AnswerRe: wincrypt.h? Pin
__yb26-Oct-05 21:30
__yb26-Oct-05 21:30 
GeneralRe: wincrypt.h? Pin
adonisv27-Oct-05 12:08
adonisv27-Oct-05 12:08 
GeneralRe: wincrypt.h? Pin
TheGreatAndPowerfulOz28-Oct-05 3:21
TheGreatAndPowerfulOz28-Oct-05 3:21 
GeneralRe: wincrypt.h? Pin
adonisv28-Oct-05 13:46
adonisv28-Oct-05 13:46 
GeneralRe: wincrypt.h? Pin
__yb31-Oct-05 21:10
__yb31-Oct-05 21:10 
Questiona garbage value from va_arg() Pin
plowstar26-Oct-05 19:29
plowstar26-Oct-05 19:29 

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.