Click here to Skip to main content
15,895,370 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to end a thread Pin
Mark Salsbery15-Dec-07 7:45
Mark Salsbery15-Dec-07 7:45 
GeneralRe: How to end a thread Pin
Chen-XuNuo14-Dec-07 18:15
Chen-XuNuo14-Dec-07 18:15 
GeneralRe: How to end a thread Pin
Mark Salsbery15-Dec-07 7:33
Mark Salsbery15-Dec-07 7:33 
GeneralRe: How to end a thread Pin
Chen-XuNuo15-Dec-07 3:14
Chen-XuNuo15-Dec-07 3:14 
GeneralRe: How to end a thread Pin
Mark Salsbery15-Dec-07 7:31
Mark Salsbery15-Dec-07 7:31 
GeneralRe: How to end a thread Pin
Chen-XuNuo15-Dec-07 14:52
Chen-XuNuo15-Dec-07 14:52 
AnswerRe: How to end a thread Pin
Cedric Moonen13-Dec-07 20:26
Cedric Moonen13-Dec-07 20:26 
GeneralRe: How to end a thread Pin
Mark Salsbery13-Dec-07 20:38
Mark Salsbery13-Dec-07 20:38 
GeneralRe: How to end a thread Pin
Chen-XuNuo14-Dec-07 4:40
Chen-XuNuo14-Dec-07 4:40 
GeneralC2365 error Pin
subramanyeswari13-Dec-07 18:54
subramanyeswari13-Dec-07 18:54 
GeneralRe: C2365 error Pin
Mark Salsbery13-Dec-07 19:13
Mark Salsbery13-Dec-07 19:13 
GeneralRe: C2365 error Pin
subramanyeswari13-Dec-07 19:59
subramanyeswari13-Dec-07 19:59 
QuestionA non-const reference may only be bound to an lvalue? Pin
George_George13-Dec-07 18:50
George_George13-Dec-07 18:50 
AnswerRe: A non-const reference may only be bound to an lvalue? Pin
Iain Clarke, Warrior Programmer14-Dec-07 1:21
Iain Clarke, Warrior Programmer14-Dec-07 1:21 
GeneralRe: A non-const reference may only be bound to an lvalue? Pin
toxcct14-Dec-07 2:38
toxcct14-Dec-07 2:38 
GeneralRe: A non-const reference may only be bound to an lvalue? Pin
Iain Clarke, Warrior Programmer14-Dec-07 3:29
Iain Clarke, Warrior Programmer14-Dec-07 3:29 
GeneralRe: A non-const reference may only be bound to an lvalue? Pin
toxcct14-Dec-07 3:30
toxcct14-Dec-07 3:30 
GeneralRe: A non-const reference may only be bound to an lvalue? Pin
Nelek16-Dec-07 21:11
protectorNelek16-Dec-07 21:11 
GeneralRe: A non-const reference may only be bound to an lvalue? Pin
George_George14-Dec-07 17:56
George_George14-Dec-07 17:56 
GeneralRe: A non-const reference may only be bound to an lvalue? Pin
Iain Clarke, Warrior Programmer14-Dec-07 22:28
Iain Clarke, Warrior Programmer14-Dec-07 22:28 
GeneralRe: A non-const reference may only be bound to an lvalue? Pin
George_George16-Dec-07 2:24
George_George16-Dec-07 2:24 
GeneralRe: A non-const reference may only be bound to an lvalue? Pin
Iain Clarke, Warrior Programmer16-Dec-07 8:02
Iain Clarke, Warrior Programmer16-Dec-07 8:02 
GeneralRe: A non-const reference may only be bound to an lvalue? Pin
George_George16-Dec-07 20:50
George_George16-Dec-07 20:50 
GeneralRe: A non-const reference may only be bound to an lvalue? Pin
Iain Clarke, Warrior Programmer16-Dec-07 22:13
Iain Clarke, Warrior Programmer16-Dec-07 22:13 
The bug is the DoSomethingNotConst () being called in the operator = function, and the compiler not telling you off, because you hadn't consted the reference(s) in the operator= function.

In the following snippet

Class C a,b;

b.FillWithValues ();

a = b;


you would expect a = b to not change b at all.

And if you write the copy constructor using a const reference, then it is harder to mess up and make that mistake. That's all. The const keyword just makes it that bit harder for you to mess up.

If you're a super programmer who never makes mistakes, and remembers the reason for every line of code you've ever written, then you never need the const keyword at all.

Guess what. You're not that super programmer. Neither am I.

const is like a sports cup. It makes it that bit harder to have a nasty injury.

Iain.
GeneralRe: A non-const reference may only be bound to an lvalue? Pin
George_George16-Dec-07 22:35
George_George16-Dec-07 22:35 

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.