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

Search:

Type: Posts; User: wolle

Page 1 of 27 1 2 3 4

Search: Search took 0.05 seconds.

  1. Re: Rookie query about short and byte arithmetic/bitwise ops

    They know, and they call it the C# type promotion rules. It can give "somewhat unexpected results" mentioned here,

    https://prasadiapsara.wordpress.com/2013/07/21/csharp-type-promotion-rules/

    To...
  2. Thread: C++ Books

    by wolle
    Replies
    4
    Views
    14,972

    Sticky: Re: C++ Books

    Here is an open-access research article called "Thriving in a crowded and changing world: C++ 20062020". The author is no less than Bjarne Stroustrup, the founder of C++. Even if it is not a book,...
  3. Re: What is the counterpart of this C pointer programme in C#?

    In exceptional situations, there is yet another option. You can mix C# and native C++ using C++/CLI as a bridge. At least in theory. I haven't done it, so I cannot vouch for it.
  4. Re: What is the counterpart of this C pointer programme in C#?

    One of the main goals of both Java and its follow-up C# is to be resilient to programmer errors. For this reason, you cannot do things like &i and *p. Explicit references and pointers were deemed...
  5. Re: Knight's tour, recursion, dynamic programming, optimization

    But the Knight's tour can be formulated as an optimization problem, so I guess my claim is wrong.

    One can define the distance between two squares as the fewest moves it takes for the knight to go...
  6. Replies
    2
    Views
    862

    Re: What is GCC High?

    What you write can be found verbatim here,

    https://www.boardworld.com.au/forums/viewthread/28006/

    So either you are also Paul Wilson, or you are plagiarizing someone else, which is fraudulent....
  7. Replies
    1
    Views
    498

    Re: N+1 SELECT problem in Hibernate

    Here's someone who claims to have a solution,

    https://www.sipios.com/blog-tech/eliminate-hibernate-n-plus-1-queries

    I haven't heard about this problem before. But if it's a common inefficiency,...
  8. Thread: C++ IDE Query

    by wolle
    Replies
    5
    Views
    589

    Re: C++ IDE Query

    In my view, it can be a good thing to first go through the process of learning how to use the different individual tools involved in program development. Then when you start using an IDE you are in a...
  9. Re: Knight's tour, recursion, dynamic programming, optimization

    Dynamic programming is an optimization method and as such is used when you are looking for what is best in some sense. It could be to find the shortest or the cheapest of something. But that does not...
  10. Replies
    2
    Views
    719

    Re: Stupid Things Developers Do

    The easiest way to be stupid as a programmer is trying too hard to be smart. Spending lots of time reducing a straightforward algorithm into something only Einstein could understand, to be able to...
  11. Re: Knight's tour, recursion, dynamic programming, optimization

    The Wikipedia entry to Knight's tour,

    https://en.wikipedia.org/wiki/Knight%27s_tour

    reveals that there are 26,534,728,821,064 (directed closed) tours on an 8x8 board. It will take a lot of time...
  12. Thread: C++ IDE Query

    by wolle
    Replies
    5
    Views
    589

    Re: C++ IDE Query

    It's even so that some IDE:s allow you to use more than one C++ compiler. For example, VS 2019 supports the use of both the Microsoft and the Clang C++ compilers.
  13. Replies
    19
    Views
    705

    Re: Template class inside a vector

    You can create a union of these 3 types using std::variant. If you declare a variable of that union type, you can check which of the types is stored in the variable using std::visit. You will need...
  14. Replies
    19
    Views
    705

    Re: Template class inside a vector

    An alternative to what 2kaud suggests is to go for an object-oriented design. In that case, you would replace T with a base class type. Then you would store objects of classes derived from the base...
  15. Replies
    19
    Views
    705

    Re: Template class inside a vector

    You must specify the typename T of TableRow. Say you want it to be an int you do,



    std::vector<TableRow<int>> row;
  16. Re: is it safe to use the bitwise XOR for boolean types (in c++)

    It is best to use the logical XOR operator != whereby



    bool c = !(a^b);


    becomes
  17. Re: Not sure what the best way to handle this task is.

    I would use one of these, probably the first,


    void checkTheState() {
    const bool hasChanged =
    (boolOne != boolOneCurrentState()) ||
    (boolTwo != boolTwoCurrentState()) ||
    ......
  18. Replies
    19
    Views
    5,059

    Re: header files online database

    Instead of excavating the past, you could go for something current,

    https://www.sqlite.org/index.html
  19. Re: How to generate a condition (true or false) based on possibilities?

    In this case, you have a total of 52 balls in the urn. The chance of picking a blue is 50/52, and a red is 2/52. The total probability is 50/52 + 2/52 = 52/52 = 1 (the ball will always be either blue...
  20. Re: How to generate a condition (true or false) based on possibilities?

    The link in my previous reply suddenly doesn't seem to work so I supply an example. It is based on the recipe: "Generating pseudo-random numbers" in Modern C++ Programming Cookbook, 2nd ed. by Marius...
  21. Re: How to generate a condition (true or false) based on possibilities?

    If you have the possibilities 0.8, 0.1, and 0.1 you think of them as three intervals,

    1: 0.0 <= x < 0.8
    2: 0.8 <= x < 0.9
    3: 0.9 <= x < 1.0

    Then you draw a random float x between 0 and 1, for...
  22. Replies
    6
    Views
    883

    Re: Need to convert an INT to WORD*

    Well, according to the link in my previous post, according to the C++ standard, a reinterpret_cast should work,

    "3) A value of any integral or enumeration type can be converted to a pointer type."...
  23. Replies
    6
    Views
    883

    Re: Need to convert an INT to WORD*

    As a last resort, there's always the reinterpret_cast,


    wpAddress = reinterpret_cast<WORD*>(nAddress);


    https://en.cppreference.com/w/cpp/language/reinterpret_cast
  24. Re: challenged problem C++ implementation - homework help (preparing for an interview

    This problem is quite common and there are several ways to solve it,

    https://web.stanford.edu/class/cs9/sample_probs/TwoSum.pdf

    The video uses the hashtable approach. A hashtable is a data...
  25. Replies
    6
    Views
    555

    Re: string replace related

    And you are not the only one :). I recognize the problem because I replied to this thread,

    https://forums.codeguru.com/showthread.php?563893-Program-to-decompress-a-compressed-string
Results 1 to 25 of 658
Page 1 of 27 1 2 3 4


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)