Click here to Skip to main content
15,887,485 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: pointer Pin
harold aptroot23-Aug-09 8:40
harold aptroot23-Aug-09 8:40 
QuestionHRESULT:0x8007007E Pin
MozhdehQeraati21-Aug-09 18:32
MozhdehQeraati21-Aug-09 18:32 
AnswerRe: HRESULT:0x8007007E Pin
Code-o-mat21-Aug-09 22:03
Code-o-mat21-Aug-09 22:03 
AnswerRe: HRESULT:0x8007007E Pin
Hristo-Bojilov22-Aug-09 6:02
Hristo-Bojilov22-Aug-09 6:02 
GeneralRe: HRESULT:0x8007007E Pin
MozhdehQeraati23-Aug-09 18:11
MozhdehQeraati23-Aug-09 18:11 
GeneralRe: HRESULT:0x8007007E Pin
Hristo-Bojilov24-Aug-09 10:16
Hristo-Bojilov24-Aug-09 10:16 
QuestionCreating an object using a reference Pin
thelonesquirrely21-Aug-09 8:28
thelonesquirrely21-Aug-09 8:28 
AnswerRe: Creating an object using a reference Pin
Stuart Dootson21-Aug-09 9:48
professionalStuart Dootson21-Aug-09 9:48 
thelonesquirrely wrote:
then we were thinking if it was safe to create a lock like this:

...
Lock l (Mutex m);
... // never using m


correct me if I am wrong, but then m is scoped with l. This works if I only want m to exist for l.


No, that's incorrect. You're declaring a function, l, which takes a Mutex parameter called m and returning a lock. You cannot declare and define a variable in a function call. To demonstrate this, run this code:

#include <iostream>

class Mutex
{
public:
   Mutex() { std::cout << "Mutex::Mutex\n"; }
   ~Mutex() { std::cout << "Mutex::~Mutex\n"; }
};

class Lock
{
public:
   Lock(Mutex& m) : m_(m) { std::cout << "Lock::Lock\n"; }
   ~Lock() { std::cout << "Lock::~Lock\n"; }
private:
   Mutex& m_;
};

int main()
{
   Lock l(Mutex m);
}


You'll get no output, because no objects are being created or destroyed!

thelonesquirrely wrote:
Is there any taboo no-nos to doing the prior method? Some pitfalls I am not seeing?


The main pitfall is that you never define a Lock variable, so you're not going to get any locking behaviour.

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

QuestionHow to join two data tables in different database Pin
jiabin_007_love21-Aug-09 7:17
jiabin_007_love21-Aug-09 7:17 
AnswerRe: How to join two data tables in different database Pin
David Crow21-Aug-09 9:24
David Crow21-Aug-09 9:24 
AnswerRe: How to join two data tables in different database Pin
jiabin_007_love21-Aug-09 18:16
jiabin_007_love21-Aug-09 18:16 
AnswerRe: How to join two data tables in different database Pin
David Crow22-Aug-09 16:43
David Crow22-Aug-09 16:43 
GeneralRe: How to join two data tables in different database Pin
jiabin_007_love23-Aug-09 16:22
jiabin_007_love23-Aug-09 16:22 
QuestionHow to get a Windows Service custom Status? [C++/C#] Pin
Shaitan0021-Aug-09 6:59
Shaitan0021-Aug-09 6:59 
QuestionIntercepting PlaySound Pin
Marc Clifton21-Aug-09 4:38
mvaMarc Clifton21-Aug-09 4:38 
AnswerRe: Intercepting PlaySound Pin
Randor 21-Aug-09 5:07
professional Randor 21-Aug-09 5:07 
QuestionProblem with atlcomcli.h assertion failure Pin
Largo6521-Aug-09 4:19
Largo6521-Aug-09 4:19 
AnswerRe: Problem with atlcomcli.h assertion failure Pin
Stuart Dootson21-Aug-09 10:03
professionalStuart Dootson21-Aug-09 10:03 
QuestionCalling C Functions in Inline Assembly MSDN example doesn't work here Pin
invader8221-Aug-09 4:08
invader8221-Aug-09 4:08 
AnswerRe: Calling C Functions in Inline Assembly MSDN example doesn't work here Pin
Randor 21-Aug-09 4:43
professional Randor 21-Aug-09 4:43 
GeneralRe: Calling C Functions in Inline Assembly MSDN example doesn't work here Pin
invader8221-Aug-09 5:22
invader8221-Aug-09 5:22 
GeneralRe: Calling C Functions in Inline Assembly MSDN example doesn't work here Pin
Randor 21-Aug-09 7:43
professional Randor 21-Aug-09 7:43 
GeneralRe: Calling C Functions in Inline Assembly MSDN example doesn't work here Pin
invader8223-Aug-09 22:33
invader8223-Aug-09 22:33 
Question[Message Deleted] Pin
Gajendra Sharma21-Aug-09 2:28
Gajendra Sharma21-Aug-09 2:28 
Answer[Message Deleted] Pin
Gajendra Sharma21-Aug-09 2:34
Gajendra Sharma21-Aug-09 2:34 

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.