Search:

Type: Posts; User: Elysia

Page 1 of 20 1 2 3 4

Search: Search took 0.21 seconds.

  1. Well, depends on the algorithm, I guess. I can...

    Well, depends on the algorithm, I guess. I can see sort() messing up the string. I can see a reverse algorithm also messing up the string. Good point. Didn't think of that. I've rarely run algorithms...
  2. Best way is to keep all your files in UTF8. Keep...

    Best way is to keep all your files in UTF8. Keep all your strings internally as UTF16. This is probably a bit tricky since there is no native way to do this. This depends on your compiler, if it can...
  3. They may or may not. It depends on your character...

    They may or may not. It depends on your character set. If it's UTF8 or ANSI, there shouldn't be any problems. But if you're using UTF16 or something else, you may get problems with \r and \n...
  4. The problem is most likely going to mount down to...

    The problem is most likely going to mount down to whether or not your system supports UTF8 or not in its interfaces taking char* parameters. Linux does. Windows does not.
    There are wide versions,...
  5. What you need to write in C++ is: std::string...

    What you need to write in C++ is:
    std::string asterisk;
  6. Thread: References

    by Elysia
    Replies
    11
    Views
    8,912

    printf("fooRef: %d\n", fooRef); printf("foo:...

    printf("fooRef: %d\n", fooRef);
    printf("foo: %d\n", foo);
    This is just undefined behavior. Don't use printf in C++.


    This doesn't tell you anything.
    This example might be interesting:
    ...
  7. Thread: References

    by Elysia
    Replies
    11
    Views
    8,912

    No, a reference is not a memory address. It's a...

    No, a reference is not a memory address. It's a type that may contain data and functions. Hence it does make sense to treat it as an "int".

    If you're just trying to understand references, then...
  8. Thread: References

    by Elysia
    Replies
    11
    Views
    8,912

    *this is not 1000. this is a pointer to the class...

    *this is not 1000. this is a pointer to the class itself, hence *this is the class itself. The class is not an integer, hence that is not valid.
  9. Replies
    18
    Views
    15,759

    The clang source uses CMake to build it.

    The clang source uses CMake to build it.
  10. Replies
    18
    Views
    15,759

    Last I tried to open clang (CMake) with VS 2017...

    Last I tried to open clang (CMake) with VS 2017 RC, it didn't work. So there's that.
  11. >>std::cout > n; That's...

    >>std::cout << ">> ", std::cin >> n;
    That's equivalent to:
    std::cout << ">> ";
    std::cin >> n;
  12. Thread: Compiler.

    by Elysia
    Replies
    11
    Views
    14,985

    That was not the point. The point was that, you...

    That was not the point. The point was that, you can't expect or demand that legacy software runs on modern operating systems, because chances are, it won't. You should upgrade your software. How much...
  13. Thread: Compiler.

    by Elysia
    Replies
    11
    Views
    14,985

    Modern operating systems do not support legacy...

    Modern operating systems do not support legacy software. We've been through this. If you want to run VC6, go ahead and run an older Windows in a virtual machine.
  14. Thread: Compiler.

    by Elysia
    Replies
    11
    Views
    14,985

    Additionally there's GCC (MinGW for Windows) and...

    Additionally there's GCC (MinGW for Windows) and Clang (though that's a pain to get working for Windows).
  15. Replies
    8
    Views
    18,297

    #include #include constexpr...

    #include <vector>
    #include <string>

    constexpr int size = 2; // Use constexpr for constant data, if possible; otherwise const.
    std::vector<std::string> array{ makeArray(size) }; // Use...
  16. Replies
    12
    Views
    11,414

    Before posting, copy & paste the code you're...

    Before posting, copy & paste the code you're going to post into a source file and compile.
    Does it fail to compile? Don't post it.
    Does it work as it should? Don't post it.

    Does it compile and...
  17. Replies
    6
    Views
    7,529

    Use a vector: std::vector Buf(1024); //...

    Use a vector:

    std::vector<char> Buf(1024);
    // Write to buffer
    // Null terminate buffer if boost doesn't
    // Now let's add the buffer to the string
    MyStr += &Buf[0];

    It would be easier if you...
  18. Replies
    1
    Views
    7,218

    Yeah, I've tested it - and used it for a while...

    Yeah, I've tested it - and used it for a while now, mostly for C#. It fixes the annoying issue where the IDE hangs when terminating a debug session in C#. And obviously it implements more C++ stuff -...
  19. Thread: Smart Pointers

    by Elysia
    Replies
    13
    Views
    9,295

    Just disable optimizations: invoking default...

    Just disable optimizations:

    invoking default constructor
    invoking move constructor


    Always!!!
  20. Thread: Smart Pointers

    by Elysia
    Replies
    13
    Views
    9,295

    >> moveable m; >> m = get_moveable();...

    >> moveable m;
    >> m = get_moveable();
    Change that to

    auto m = get_moveable();

    and enable optimizations. The former might work if the compiler is smart enough.
    Also, remove "void" from...
  21. It depends a little on your requirements too. The...

    It depends a little on your requirements too. The above mentioned laptop has poor resolution, no SSD and a watered-down processor.
    Personally, I'd go for something like Acer 15.6" V5-591G-55PV Intel...
  22. Thread: Smart Pointers

    by Elysia
    Replies
    13
    Views
    9,295

    It's not related to RVO. If you have a local...

    It's not related to RVO. If you have a local variable that is returned and meets a certain set of requirements, it's implicitly moved when you return it. If RVO kicks in, then the variable won't even...
  23. Thread: Smart Pointers

    by Elysia
    Replies
    13
    Views
    9,295

    It is true that shared_ptr can subsume all other...

    It is true that shared_ptr can subsume all other pointers (except weak_ptr for certain situations). However, shared_ptr has more overhead than unique_ptr and scoped_ptr (which is actually not a smart...
  24. Replies
    27
    Views
    111,847

    Sticky: Ugh. C# can be pretty confusing too because it...

    Ugh. C# can be pretty confusing too because it doesn't make a distinction between a pointer and a reference. It's motto seems to be just pass the damn object and it will work. Except, sometimes it...
  25. This whole weird and stupid behaviour is due to...

    This whole weird and stupid behaviour is due to C++'s C legacy. Basically, the C standard says it shall work as you see it works. C++ fixed the problem with reference types, so passing an array by...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4