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.05 seconds.

  1. Replies
    3
    Views
    7,130

    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...
  2. 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...
  3. 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.
  4. 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
  5. Thread: Tutorials

    by 2kaud
    Replies
    8
    Views
    462

    Re: Tutorials

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

    by 2kaud
    Replies
    8
    Views
    462

    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,...
  7. Thread: Finding Doubles

    by 2kaud
    Replies
    12
    Views
    840

    Re: Finding Doubles

    As a possible starter, perhaps:



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

    std::mt19937 engine {std::random_device {}()};
  8. Thread: Tutorials

    by 2kaud
    Replies
    8
    Views
    462

    Re: Tutorials

    There are some c++ 'cook-books' which give plenty of examples for STL.

    A couple come to mind. These are also available for download.

    Packt
    - C++17 STL cookbook...
  9. Thread: Tutorials

    by 2kaud
    Replies
    8
    Views
    462

    Re: Tutorials

    Well standard c++ doesn't include gui. If you need gui you need to use 3rd party.

    For STL, I can suggest books that cover STL, but not specific on-line tutorials.

    There is the on-line c++...
  10. Thread: Finding Doubles

    by 2kaud
    Replies
    12
    Views
    840

    Re: Finding Doubles

    What you mean by 'find doubles'? Can you give an example.
  11. Thread: IDC resource

    by 2kaud
    Replies
    1
    Views
    159

    Re: IDC resource

    The radio buttons that should act together need to be in the same group control. It looks like the new button isn't part of the existing group.
  12. Replies
    10
    Views
    775

    Re: wait .. no blocking

    plus Windows events, mutexs, semaphores etc etc etc

    We only use Windows and our main threading code was written before C++11. We looked into moving to std::threads etc but we concluded that the...
  13. Replies
    10
    Views
    775

    Re: wait .. no blocking

    Sorry, but I don't use std::threads either.
  14. Thread: array of objects

    by 2kaud
    Replies
    14
    Views
    1,194

    Re: array of objects

    @EE

    I commented out SetThreadPriority() just for my testing - as it wasn't part of the issue.

    inline static int count{}; //this line gives error in v14.0 platform - You need to update your...
  15. Thread: array of objects

    by 2kaud
    Replies
    14
    Views
    1,194

    Re: array of objects

    Since C++17, you use inline with static. See my code above.

    However, the problem is with the std::thread(). You need to pass obj[i] by address - not by value. The way you're doing it means that...
  16. Replies
    4
    Views
    478

    Re: threads and function call

    I don't use C++ multi-threading - we used Windows threading prior to threads being introduced into C++ and have stuck with this since.

    However, with multi-threading you have to make sure that...
  17. Thread: array of objects

    by 2kaud
    Replies
    14
    Views
    1,194

    Re: array of objects

    Correct. This is how the code should work.

    This behaviour is caused by the call to vector constructor. You are passing 10 and MyClass() as arguments. This means create 10 elements and initialise...
  18. Thread: array of objects

    by 2kaud
    Replies
    14
    Views
    1,194

    Re: array of objects

    As I said above, post a complete compilable test program that shows the issue.
  19. Replies
    4
    Views
    478

    Re: threads and function call

    What do you mean by a 'shared header'? a and b are passed by value and the return is also by value - so there's no side-effect from calling the function. So the function itself is thread-safe. But...
  20. Thread: array of objects

    by 2kaud
    Replies
    14
    Views
    1,194

    Re: array of objects

    Post a complete compilable test program that shows the issue.
  21. Replies
    2
    Views
    409

    Re: Creating a popup window above an another.

    [Also asked at http://www.cplusplus.com/forum/windows/280300/ ]
  22. Replies
    8
    Views
    566

    Re: #warning and MSVC

    How many of them are there?

    Can you use a #ifdef ... to choose between the 2 versions depending upon the compiler used? Something like:



    #if defined (_MSC_VER)
    #pragma message("message")...
  23. Replies
    8
    Views
    566

    Re: #warning and MSVC

    How about #pragma message ?

    https://docs.microsoft.com/en-us/cpp/preprocessor/message?view=msvc-160

    #pragma NOTE is not listed as a supported #pragma for MSVS.
  24. Replies
    8
    Views
    566

    Re: #warning and MSVC

    If #warning is just to display a warning message at compile time, then perhaps #pragma comment ??

    https://docs.microsoft.com/en-us/cpp/preprocessor/comment-c-cpp?view=msvc-160
  25. Replies
    8
    Views
    566

    Re: #warning and MSVC

    In MSVS it's #pragma warning. See https://docs.microsoft.com/en-us/cpp/preprocessor/warning?view=msvc-160
Results 1 to 25 of 2000
Page 1 of 80 1 2 3 4





Click Here to Expand Forum to Full Width

Featured