Search Results - CodeGuru Forums
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: LarryChen

Page 1 of 39 1 2 3 4

Search: Search took 0.06 seconds.

  1. Any guru here can explain rules in celluar automata?

    There is too many rules in cellular automata. So is it possible to explain all the rules altogether? Thanks.
  2. Re: How to terminate a thread from outside properly?

    If I write a multi-threaded program like this,


    class CFoo
    {
    public:
    CFoo();
    ~CFoo();

    private:
  3. Re: How to terminate a thread from outside properly?

    I understand this part. What I don't understand is that why you put scoping block before return statement since without this scoping block when the function main is finished, then the destructor of...
  4. Re: How to terminate a thread from outside properly?

    I realize that a thread doesn't have to sleep in order for another thread to execute based on my debugging. However, I don't understand that without calling sleep, how can one thread "yields" its...
  5. Re: How to terminate a thread from outside properly?

    Actually I don't understand why you added the scoping block to the main function. Would you explain it a little bit? Thanks.
  6. Re: How to terminate a thread from outside properly?

    Sorry to make you confused and forget about what I said before. If the function main is like this,


    int main()
    {
    CFoo foo;
    //Sleep(5000);

    return 0;
    }
  7. Re: How to terminate a thread from outside properly?

    Thanks for the example. This piece of code actually is not my code. I wonder why we need a wait event here? I think a stop event is good enough to terminate a worker thread. Thanks.
  8. Re: How to terminate a thread from outside properly?

    The main thread gets executed first and then another thread gets executed. But at this time, the stop event is non-signaled and so the main thread never gets a chance to be executed. Therefore main...
  9. Replies
    26
    Views
    1,882

    Re: A question regarding double-checked locking

    So you meant when I run the statement static Singleton instance first time, then instance is created. But when I run the statement static Singleton instance second time, it does nothing? Thanks.
  10. Re: How to terminate a thread from outside properly?

    My question is actually related to how to design the main function so that the program can switch between the thread and main thread elegantly. If you call StopThread in the main thread as you...
  11. Replies
    26
    Views
    1,882

    Re: A question regarding double-checked locking

    Thanks fo r the explanation. in this simple implementation,


    Singleton& Singleton::getInstance() {
    static Singleton instance;
    return instance;
    }

    When we call getInstance first...
  12. How to terminate a thread from outside properly?

    Here is the code,


    /* I normally end a thread by returning from the Thread function or calling ExitThread within the thread function. To close a thread from outside we can use wait and signal...
  13. Replies
    26
    Views
    1,882

    Re: A question regarding double-checked locking

    Thanks for your reply. How is thread-safe achieved in static initialization with a compliant c++ implementation without using any synchronization object explicitly?
  14. Run-Time Check Failure #3 - The variable is being used without being initialized

    Under visual studio, this is a typical run time error,


    void func(int x)
    {
    x = 3;
    }

    int main()
    {
  15. Replies
    6
    Views
    454

    Re: Help me understand this algorithm.

    The algorithm you suggested is pretty straightforward but the time complexity would be n*2^n. The original algorithm I posted is n*sum which is faster. Any idea how the original algorithm works?...
  16. Replies
    7
    Views
    415

    Re: A question regarding templated function

    Basically I understand that. But in terms of how to use the functions, is there any difference? Or let me put it this way. Is there any difference between a function defined in a templated class and...
  17. Replies
    6
    Views
    454

    Help me understand this algorithm.

    Write a function that takes an array of integers and returns the number of combinations of those integers that sum to a certain number. Here is the code,


    int FindCount(int a[], int size, int...
  18. Replies
    7
    Views
    415

    A question regarding templated function

    What is the real difference between a templated function defined in a class and a function defined in a templated class?


    template <class T>
    class A
    {
    void f();
    };

    class A
  19. Replies
    7
    Views
    397

    Re: what happens when x = new int[0]?

    I see. Thanks!
  20. Replies
    7
    Views
    397

    Re: what happens when x = new int[0]?

    No, this is not a "crazy" question. I have seen people doing something like this,


    if(size>0)
    {
    int* x = new int[size];
    }

    Basically if they understand that int* x = new int[0] still...
  21. Replies
    7
    Views
    397

    what happens when x = new int[0]?

    Suppose I do this,


    int* x = new int[0];

    When I debug this statement, I found out that x did change afterwards. But since the size is zero, how would x be initialized in this case? Thanks.
  22. Replies
    3
    Views
    271

    A question regarding Hashmap(Hashtable)

    If the key of Hashmap is integer or easy to be converted to integer, then it is very convenient to use hashmap. But what if the key is a string? In that case, I can't use an array as a hashmap and...
  23. How to handle the exceptions that couldn't be caught by try/catch?

    Here is an example,


    int main()
    {
    try{
    int y = 0;
    int x = 2/y;
    }
    catch(...)
  24. How to convert an math expression into an expression tree?

    Here is an example, (a + b * c) *d * f * g . What are the steps to convert this expression into an expression tree? Basically I am able to convert it into an expression tree. But I try to learn a...
  25. Replies
    4
    Views
    425

    Re: Questions regarding a piece of code

    Really nice explanation. Thanks a lot.
Results 1 to 25 of 968
Page 1 of 39 1 2 3 4


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center