Click here to Skip to main content
15,888,579 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Mouse move over Tray Icon, the icon disappear. Pin
yu-jian24-Jan-11 15:32
yu-jian24-Jan-11 15:32 
GeneralRe: Mouse move over Tray Icon, the icon disappear. Pin
yu-jian24-Jan-11 15:30
yu-jian24-Jan-11 15:30 
Questionwhat is wrong with this code? Pin
aesthetic.crazy22-Jan-11 8:41
aesthetic.crazy22-Jan-11 8:41 
AnswerRe: what is wrong with this code? Pin
PIEBALDconsult22-Jan-11 10:15
mvePIEBALDconsult22-Jan-11 10:15 
AnswerRe: what is wrong with this code? Pin
CPallini22-Jan-11 10:39
mveCPallini22-Jan-11 10:39 
AnswerRe: what is wrong with this code? Pin
T210222-Jan-11 13:08
T210222-Jan-11 13:08 
AnswerRe: what is wrong with this code? [modified] Pin
Richard MacCutchan22-Jan-11 21:35
mveRichard MacCutchan22-Jan-11 21:35 
AnswerRe: what is wrong with this code? Pin
Aescleal23-Jan-11 6:34
Aescleal23-Jan-11 6:34 
Aside from the fact that the code doesn't do anything useful, the really serious problems with this class are:

- It will leak in normal operation (I use the term "operation" loosely here as the class doesn't do anything)
- It isn't exception safe or neutral

To fix these you're going to need a destructor, a copy constructor (or a private declaration of a copy constructor) and a swapping assignment operator (or a private declaration of an assignment operator).

In addition (ignoring the questionable sanity of storing an int like that) the implementation could be tightened up to use an initialiser list.

The idea here is to make a class that behaves like a object of a type built into the language. The structure your class needs to achieve this is known in some circles as "The Orthodox Canonical Form" and the first place I saw it mentioned and explained properly was in "Advanced C++: Programming Styles and Idioms" By Jim Coplien back in the early 90s. Other authors have picked up the term since then so a search for it might give you some more background.

Cheers,

Ash
GeneralRe: what is wrong with this code? Pin
Adam Roderick J23-Jan-11 19:04
Adam Roderick J23-Jan-11 19:04 
GeneralRe: what is wrong with this code? Pin
PIEBALDconsult24-Jan-11 2:02
mvePIEBALDconsult24-Jan-11 2:02 
AnswerRe: what is wrong with this code? [modified] Pin
Stefan_Lang30-Jan-11 23:54
Stefan_Lang30-Jan-11 23:54 
QuestionRetaining whitespace within macro replacement text Pin
PIEBALDconsult22-Jan-11 4:17
mvePIEBALDconsult22-Jan-11 4:17 
AnswerRe: Retaining whitespace within macro replacement text Pin
Andrew Brock22-Jan-11 4:38
Andrew Brock22-Jan-11 4:38 
GeneralRe: Retaining whitespace within macro replacement text Pin
PIEBALDconsult22-Jan-11 9:00
mvePIEBALDconsult22-Jan-11 9:00 
GeneralRe: Retaining whitespace within macro replacement text Pin
jschell22-Jan-11 12:01
jschell22-Jan-11 12:01 
GeneralRe: Retaining whitespace within macro replacement text Pin
PIEBALDconsult22-Jan-11 18:06
mvePIEBALDconsult22-Jan-11 18:06 
GeneralRe: Retaining whitespace within macro replacement text Pin
jschell23-Jan-11 10:40
jschell23-Jan-11 10:40 
QuestionUnknown problem with non-english languages [modified] Pin
rahul.kulshreshtha21-Jan-11 23:17
rahul.kulshreshtha21-Jan-11 23:17 
AnswerRe: Unknown problem with non-english languages Pin
Andrew Brock21-Jan-11 23:39
Andrew Brock21-Jan-11 23:39 
GeneralRe: Unknown problem with non-english languages Pin
rahul.kulshreshtha21-Jan-11 23:53
rahul.kulshreshtha21-Jan-11 23:53 
GeneralRe: Unknown problem with non-english languages Pin
Andrew Brock22-Jan-11 0:38
Andrew Brock22-Jan-11 0:38 
GeneralRe: Unknown problem with non-english languages Pin
rahul.kulshreshtha22-Jan-11 0:56
rahul.kulshreshtha22-Jan-11 0:56 
GeneralRe: Unknown problem with non-english languages Pin
Andrew Brock22-Jan-11 1:21
Andrew Brock22-Jan-11 1:21 
GeneralRe: Unknown problem with non-english languages Pin
rahul.kulshreshtha22-Jan-11 2:13
rahul.kulshreshtha22-Jan-11 2:13 
GeneralRe: Unknown problem with non-english languages Pin
Andrew Brock22-Jan-11 2:39
Andrew Brock22-Jan-11 2:39 

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.