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

Search:

Type: Posts; User: D_Drmmr

Page 1 of 80 1 2 3 4

Search: Search took 0.08 seconds.

  1. Re: adding rational number using only class functions

    No more with a signed integer than with an unsigned. What's your point?

    Like I said, I tried this for a while and stopped, because I realized I was over-complicating my code.
    With an unsigned...
  2. Re: adding rational number using only class functions

    Obviously. My point is that "the value should never be negative" is not a reason to use an unsigned type. There may still be situations where you need to take a difference or use the value in an...
  3. Re: adding rational number using only class functions

    What would you gain from making the function static? It only requires more typing.
  4. Re: adding rational number using only class functions

    I would strongly advice against mixing signed and unsigned integers. Just take this simple example:


    int numerator = -1;
    unsigned int denominator = 2;
    bool isNegative = (numerator * denominator...
  5. Re: adding rational number using only class functions

    You start by writing all the tests (in this case unit tests) and then implement your class function by function to pass all the tests. This forces you to first think about all the functionality your...
  6. Re: adding rational number using only class functions

    Better to use a bool for the sign (and name it something like isPositive or isNegative), since there can only be two possible states ever.

    Your setnumerator and setdenominator functions violate...
  7. Replies
    11
    Views
    397

    Re: Converting JAVA for loop to C++ for loop

    Don't use new [] in C++, there is no need for it. Use std::vector instead.

    And please post the code here, rather than providing some external link.
    What do you mean by "doesn't work"?
  8. Replies
    6
    Views
    376

    Re: template class with template members

    That's not really a solution. How will this code be able to create/copy/destroy an instance of X?

    @Tiny Dolls
    Why do you want to get rid of the class template? What do you want to accomplish at a...
  9. Replies
    10
    Views
    455

    Re: Handing more than one exception at a time

    Not exactly. It's not throwing the exception during stack unwinding that is the problem. The problem is when the exception thrown during stack unwinding is not caught. If you catch any thrown...
  10. Re: Problem With Sleep() When drawing ananalog clock

    Don't know if threads are covered in the book, but a quick way to make the program update approximately each second is to run the loop in a thread.


    std::atomic<bool> stop(false);...
  11. Replies
    5
    Views
    495

    Re: GUI design in C++

    Well, no, because Windows Forms requires .Net and unmanaged C++ doesn't give you that.

    What do you miss?

    If you mean a nice looking GUI application, then yes that's possible in C++.
  12. Re: Problem With Sleep() When drawing analog clock

    Calling sleep pretty much puts your program (well, the thread that calls sleep) into a coma. It doesn't do anything until it wakes from its sleep. One important thing your program won't do while it...
  13. Re: MFC Proper usage of sending message to dialog to activate

    Why not just send the dialog a custom message to tell it to update the combo box contents? Or just add a member function to the dialog class that you call directly?
  14. Re: Data structure for text predictor using qwerty keyboard in c++

    You call a dictionary application a text predictor and then conclude from that example that a dictionary is a form of text predictor. Seems like circular reasoning to me.

    I would assume the...
  15. Replies
    8
    Views
    482

    Re: Hash table efficiency

    When you say 'hashtable size' do you mean 'number of buckets'?
    I think OP meant not knowing the maximum number of data elements to be stored ahead of time.

    What makes you say this is a bad idea?...
  16. Replies
    13
    Views
    747

    Re: Calling a function in AfxBeginThread

    ...and synchronize access to the string data member using a Critical Section.
  17. Re: Exit two-threaded program with user input?

    Mandatory reading: http://www.drdobbs.com/parallel/interrupt-politely/207100682
  18. Replies
    52
    Views
    6,646

    Re: IF-free conception.

    Are you benchmarking unoptimized code? That's not very useful.
  19. Re: Please help a newbie on CPP High Frequency Trading Example

    This might be a (premature) optimization trick to prevent branching due to the short-circuiting behavior of &&.
  20. Re: How can I create a template method in a C++ class?

    Look how much easier to read your code becomes with a few local variables. You should really stop copy-pasting source code; it's a very bad habit.


    template<class T>
    ObjectBase*...
  21. Replies
    27
    Views
    17,745

    Re: scrolling popup menu via Page Up/Down

    Yes, you could do that. but it sounds to me like a list box is better suited for your user interface. This would also allow the user to select an item by typing multiple characters, which is much...
  22. Replies
    3
    Views
    2,619

    Re: Dijkstra's algorithm C++ - 2 implementations

    I'm sure you can come up with a test case that fails the second algorithm.
    As to why the first one may be too slow: a std::set keeps all its elements sorted. Dijkstra's algorithm only needs to...
  23. Replies
    4
    Views
    1,453

    Re: Creating Matrix/map for Topological sort?

    That's basically the algorithm for finding a topological order. ;)
  24. Replies
    11
    Views
    1,030

    Re: namespace expert needed :-(

    That's because there is no specialization for 'implements_load' and 'implements_store'. Don't know if you removed this to get a minimal example or if they are missing in your actual code (maybe the...
  25. Replies
    11
    Views
    1,030

    Re: namespace expert needed :-(

    Compiles fine in VC9.
    What is the complete error message you get?
Results 1 to 25 of 2000
Page 1 of 80 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