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

Search:

Type: Posts; User: laserlight

Page 1 of 80 1 2 3 4

Search: Search took 0.23 seconds.

  1. Re: Not getting the sum or a program correct

    The problem is that you computed the sum before you assigned the random numbers, i.e., this:

    int sum = num1 + num2;
    should be placed after this:

    num1 = (rand() % (Max_Value - Min_Value +1)) +...
  2. Re: Handing more than one exception at a time

    The problem of course is that a test case behaving as you expect does not contradict OReubens' claim of undefined behaviour since the behaviour that you expect falls within the realm of undefined...
  3. Re: How to generate unique number for each address?

    It is common for sizeof(short) == 2, and for the range of short to have a smaller length that the range of IPv4 addresses. Therefore, it is impossible to guarantee unique mappings from short ints to...
  4. Re: cast Base class pointer to derived class pointer: when will this fail

    None because B is not a D. If you created a D object and made a B pointer point to it, then you can cast the B pointer to be a D pointer, e.g., by using dynamic_cast. Since you started with a B...
  5. Replies
    6
    Views
    364

    Re: template class with template members

    You cannot do that since m_x is a member variable, so its type must be available at that point.
  6. Replies
    5
    Views
    262

    Re: Error : more than one operator matches

    Yeah, posting code in code tags is good, but you still need to indent your code properly. That said, have you tried:

    if (!pinstance) {
  7. Re: cast Base class pointer to derived class pointer: when will this fail

    Ahh... but then the behaviour looks wrong: a null pointer should have been returned rather than there being a compile error since "the run-time check fails". MSVC's handling would also be wrong since...
  8. Re: cast Base class pointer to derived class pointer: when will this fail

    That's why I don't trust Intellisense :p

    That said, if we change (D *)b to dynamic_cast<D*>(b), g++ 4.8.2 refuses to compile, complaining that we "cannot dynamic_cast ‘b’ (of type ‘class B*’) to...
  9. Replies
    5
    Views
    369

    Re: Text format conversion

    It is basically file:// + path, so you end up with file:///usr/local/file.txt.
  10. Replies
    6
    Views
    297

    Re: Given two numbers, return max product

    I would guess "Dynamic Programming", but that is just a guess.
  11. Replies
    12
    Views
    358

    Re: Help With This Program

    What is your current code? Remember to post it within
    bbcode tags.
  12. Replies
    5
    Views
    369

    Re: Text format conversion

    Are you specifically looking to URL encode and URL decode text?
  13. Re: can i create another type of a class?

    Why do you need this? It is not possible since classes are not objects in C++. You can declare a variable with the same name as a class, thereby hiding the class name, which is what your first...
  14. Re: can i create another type of a class?

    Perhaps you have seen class templates but did not know the name for them?

    Note that I am guessing purely on the <Button> syntax, though your code is actually invalid. If you have something in...
  15. Thread: .h and .cpp

    by laserlight
    Replies
    51
    Views
    2,357

    Re: .h and .cpp

    A quibble: despite its name, the STL is non-standard by virtue of being pre-standard. Rather, it formed the basis for a substantial portion of the C++ standard library (i.e., those parts having to do...
  16. Replies
    9
    Views
    348

    Re: file i/o from bottom to the top

    Once you have them all in a container, iterating over the container in reverse order is trivial.
  17. Replies
    9
    Views
    348

    Re: file i/o from bottom to the top

    Hmm... if we're talking about a few hundred lines of 20 numbers per line, then it sounds like just reading them all into a std::vector of groups of numbers could work.
  18. Replies
    6
    Views
    473

    Re: overriding base class template method

    You cannot do that using that syntax because the second and third expressions of the ternary operator must be compatible in type, but you can always replace it with an if/else statement:

    class B...
  19. Replies
    6
    Views
    473

    Re: overriding base class template method

    You're overloading, not overriding, therefore it seems to me that you could just write:

    class B
    {
    public:
    template<class T>
    T foo()
    {
    return T();
    }
  20. Re: what is the difference between g++ and gcc in compiler?

    Well, it is clearly C code (though I note that /n probably is a typo for \n), so why would you want to compile with g++ when you can compile with gcc and have it work? You could use extern "C" and...
  21. Re: what is the difference between g++ and gcc in compiler?

    If I remember correctly, if you use gcc to build a program with source files that have file extensions normally used for C++, it will compile as C++, but not link with the C++ standard library by...
  22. Replies
    2
    Views
    305

    Re: [Help] Join Two Tables

    This sounds more like a question concerning SQL and relational databases rather than a question on C++. If so, a moderator might move this thread.

    What are the relevant fields from the movie and...
  23. Re: problems with passing std::multimap as a parameter

    You probably want to pass the container by reference.
  24. Replies
    21
    Views
    1,030

    Re: Opinions on my get/set approach

    I think razzle is referring to a class where the member variables are private (and not declared mutable), and all the non-static member functions are const member functions. This way, even if objects...
  25. Replies
    13
    Views
    1,457

    Re: Please recommend a Python book

    Heh, you people are tempting me to get this book too.
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