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

Search:

Type: Posts; User: 2kaud

Page 1 of 80 1 2 3 4

Search: Search took 0.06 seconds; generated 48 minute(s) ago.

  1. Replies
    11
    Views
    229

    Re: casting pointer to template type

    ...but you're indexing rfp.pfOut via iOutIndex as if it's an array...
  2. Replies
    11
    Views
    229

    Re: casting pointer to template type

    That just says that the pfOut pointer is set to nullptr - ie set to 0 ie not used/specified. Hence the test:



    if ( rfp.pfOut )


    which checks for the nullptr condition.
  3. Replies
    11
    Views
    229

    Re: casting pointer to template type

    Simply, rfp.pfOut is a pointer to a float (val) which is a single variable and not an array. But you are treating rtp.pfOut as if it's an array pointer whn it's not. Hence the issue.
    ...
  4. Replies
    11
    Views
    229

    Re: casting pointer to template type

    Note though, that this isn't consider 'good practice'. Usually reinterpret_cast highlights some design issue and such code is often considered 'flakey' and 'fragile'. Use at own risk!
  5. Replies
    11
    Views
    229

    Re: casting pointer to template type

    You can't use static_cast on pointers. Use reinterpret_cast.
  6. Replies
    14
    Views
    883

    Re: New file inclusion problem on legacy code

    Have you considered using std:: optional? There is also a nullopt value. https://en.cppreference.com/w/cpp/utility/optional

    If not that, then perhaps return say a std:: pair - one element value,...
  7. Replies
    14
    Views
    883

    Re: New file inclusion problem on legacy code

    Well FWAInfo.h must have an include which then includes FWAInfo.h somewhere or another already included file - causing the circular dependency. You''ll need to find what in FWAInfo,h is causing the...
  8. Re: why i can't create a memory HBitmap and draw it?

    [Also asked and answered here http://www.cplusplus.com/forum/general/281591/ ]
  9. Replies
    14
    Views
    883

    Re: New file inclusion problem on legacy code

    Yes I know - but I don't know of any. We have a tool which shows the #include hierarchy - but not what each include defines.
  10. Replies
    14
    Views
    883

    Re: New file inclusion problem on legacy code

    Yeah - use a pen and paper and work through the includes!

    Seriously, you need to work through the includes/code, find each of the different defined types (classes/structs etc), note their name...
  11. Replies
    14
    Views
    883

    Re: New file inclusion problem on legacy code

    Well that is fairly easy to determine by finding out the include dependencies for each .cpp/.h file uses. Once you have that, then you can ascertain if there any circular dependencies and which .h...
  12. Re: Occcont.cpp error when migrating old VS2005 application to Visual Studio

    I suggest you create a new solution/project in VS2022 and add the required .cpp/.h et al files, set this solution/project properties as required and then compile. You shouldn't then have any...
  13. Replies
    4
    Views
    658

    Re: ifstream and nulls

    You could read it into a std::string as std::string can contain nulls. Something like:



    std::ifstream ifs;
    std::string buf(2048, 0);

    ifs.open(m_FilePath, std::ifstream::in |...
  14. Replies
    4
    Views
    658

    Re: ifstream and nulls

    buf is sized at 2048, but 20481 chars are tried to be read??
  15. Re: How to "FormatMessage()" my "WSAGetLastError()"

    Well it seems to! eg WSA error code WSAEDESTADDRREQ (10039) is "Destination required"

    if you use 10039 in my code above, it shows:

    A required address was omitted from an operation on a socket....
  16. Re: How to "FormatMessage()" my "WSAGetLastError()"

    This is what I used when I did Windows programming:



    #define WIN32_LEAN_AND_MEAN
    #define NOMINMAX
    #include <windows.h>

    #include <string>
    #include <iostream>
  17. Replies
    5
    Views
    1,344

    Re: Generate test cases

    You might find this article of interest
    http://alexott.net/en/cpp/CppTestingIntro.html
  18. Replies
    6
    Views
    2,047

    Re: Sudden problem with std::vector

    For a constexpr function to return a constexpr value, any functions it calls must also be marked as constexpr. ie. can be evaluated at compile time. Unfortunately, sqrt() isn't one of them.

    See...
  19. Replies
    3
    Views
    7,677

    Re: Pascal to c++ translator

    The above is Pascal. Is there a c++ question somewhere in this?

    If you want this translated to c++, it's not that different. var in a function parameter means 'pass by ref'. lo,,hi for an array...
  20. Re: Why is my single thread code is faster than my multhread code?

    I don't know Vulcan so can only generalise.

    It is a known fact that multi-threaded code can be slower than single-threaded. There are a couple of reasons for this. One is that it takes time to...
  21. Re: Is it safe to locally use arrays, vectors and calloc when multi-threading

    The current version is VS 2022 which provides support for C++20. The Community version is still free. I suggest you install VS2022. This will happily co-exist with VS2017. It uses the same installer.
  22. Re: Is it safe to locally use arrays, vectors and calloc when multi-threading

    Yes.

    Although in C++ programs you should use new/delete rather than calloc/malloc/free
  23. Thread: Tutorials

    by 2kaud
    Replies
    8
    Views
    576

    Re: Tutorials

    Sorry, no. I have no knowledge of that book. But from it's contents it looks just like a C++ intro book.
  24. Thread: Tutorials

    by 2kaud
    Replies
    8
    Views
    576

    Re: Tutorials

    For a tutorial, have a look at https://www.learncpp.com/ - although it's somewhat light on the STL.

    Codeguru has c++ articles (see https://www.codeguru.com/cplusplus/ )

    Rather than articles,...
  25. Thread: Finding Doubles

    by 2kaud
    Replies
    12
    Views
    1,009

    Re: Finding Doubles

    As a possible starter, perhaps:



    #include <random>
    #include <unordered_set>
    #include <iostream>

    std::mt19937 engine {std::random_device {}()};
Results 1 to 25 of 1982
Page 1 of 80 1 2 3 4





Click Here to Expand Forum to Full Width

Featured