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

Search:

Type: Posts; User: natskvi

Search: Search took 0.01 seconds.

  1. Mocking a class whose constructor is called by a "black box"

    I am trying to isolate for the purpose of unit testing class A which uses internally class Socket (a facade for socket function calls). The tools I am using are Visual Studio 2005, Visual Assert...
  2. Replies
    22
    Views
    8,813

    Re: Debugging suspected memory overwrite

    In addition to what everyone said, and this is more of a preventive measure, make sure you set the warning level to the highest (/W4 or /WAll) and "Treat warnings as errors" is on. Also use a static...
  3. Replies
    3
    Views
    940

    Re: Expression template libraries

    Thanks aamir and Lindley.
  4. Replies
    3
    Views
    940

    Expression template libraries

    Item 30 in Sutter's and Alexandrescu's C++ Coding Standards states, "Avoid overloading &&, || or , (comma)", but lists as an exception to this rule expression template libraries, which by design...
  5. Thread: Networks/Users

    by natskvi
    Replies
    2
    Views
    3,334

    Re: Networks/Users

    This is a C++ forum...
  6. Replies
    11
    Views
    897

    Re: Testing my software

    What platform are you developing on, Linux or Windows? What tools are you using?
  7. Replies
    2
    Views
    6,496

    Re: Knight's tour c++

    if (counter <= 64)

    As nuzzle pointed out, this accomplishes nothing. What you probably want instead is a terminating base condition of counter == 64, and a for-loop that calls the method...
  8. Replies
    2
    Views
    1,937

    Re: cin>>num and alphanumeric

    This question has been answered here:

    http://www.codeguru.com/forum/showthread.php?t=231054
  9. Re: Compiler error converting a base class pointer to a derived class pointer

    Usually you want a base pointer to point to derived objects. But if your intention really was to do a downcast then add runtime polymorphism and use dynamic_cast, never reinterpret_cast, as monarch...
  10. Replies
    8
    Views
    873

    Re: New Program! Help!

    Okay, done.
  11. Replies
    12
    Views
    1,395

    Re: Templates cause slower run-time?

    1. Dynamic resizing.
    2. Keeping track of capacity (if you don't use a compiler that has countof operator, such as Microsoft's _countof).
    3. Keeping track of size, otherwise you need some size...
  12. Replies
    8
    Views
    873

    Re: New Program! Help!

    diligent_tech,
    The variables envelope, small, medium and large should be declared as bool's. All other variables in your program should be declared as float's or double's. It is good C++...
  13. Re: Having trouble with fread and strange characters

    I think what Richard meant was



    ...
    // allocate memory to contain the whole file:
    buffer = (char*) malloc (sizeof(char)*(lSize+1)); // +1
    if (buffer == NULL) {fputs ("Memory...
  14. Re: Refactoring that uses function templates specialization

    The code handling strings uses helper functions, and I wanted to hide this implementation detail from clients. It seems that when it comes to function template specialization, there is a trade-off...
  15. Re: Refactoring that uses function templates specialization

    I'm sorry, I forgot to mention that read was doing something different to read strings as opposed to other types (which were handled by the DEF_READ macros), so I had to specialize read for strings. ...
  16. Replies
    3
    Views
    935

    Re: How to convert a string to a cstring?

    Using the C standard library's tolower generates a compiler warning about casting from int to char (if you are compiling at the highest warning level, since the signature of tolower is int...
  17. Refactoring that uses function templates specialization

    This is a C++ design question. The design below was a refactoring of a very long and very badly designed copy-and-paste source file. It uses policy classes and templates, and it is a major...
  18. Replies
    3
    Views
    1,462

    Re: [C++] fprintf problem (ofstream)

    Why the mix of C++ streams and old C-style FILE handles? I would do away with #include <cstdio> and use only ofstream's, ifstreams and manipulators. My understanding from reading C++ Coding...
  19. Replies
    2
    Views
    611

    Re: Generating Pairs from a given list

    Let's say you want to call your new generic algorithm unzip (analogous to Haskell's unzip function, see http://www.zvon.org/other/haskell/Outputprelude/unzip_f.html). Then


    template <typename...
  20. Replies
    0
    Views
    1,355

    Generic programming: transform_if

    Hello all,

    I am using GCC 3.4.4 on CygWin and I am trying to write an algorithm that combines the functionality of both std::transform and a filter.

    Here is one version that expects you to pass...
Results 1 to 20 of 20





Click Here to Expand Forum to Full Width

Featured