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

Search:

Type: Posts; User: laserlight

Page 1 of 80 1 2 3 4

Search: Search took 0.18 seconds.

  1. Replies
    2
    Views
    80

    Re: Safe conversion?

    The result of the static_cast is undefined:
  2. Re: how to properly concatenate two std::string with binary data

    That should work: null characters are not relevant to operator+ where both arguments are std::string objects.
  3. Replies
    12
    Views
    335

    Re: Basic operator overloading

    As I observed earlier, the given operator+= only uses public member functions of the vmSize class, hence it does not access the internals, thus there is no reason (as observed) to have it as a...
  4. Replies
    12
    Views
    335

    Re: Basic operator overloading

    Your implementation of operator+= looks fine to me, though I would not bother prefixing the member function calls for the current object with this->.

    One thing to think about is the notion of...
  5. Re: unsigned char* to string& being passed into function

    Well, I say that malloc was unnecessary to begin with since the string could have been created and then used even with C interfaces that expect a null terminated string.
  6. Replies
    12
    Views
    335

    Re: Basic operator overloading

    Thankfully, Stroustrup has an explanation ready: Is ``int* p;'' right or is ``int *p;'' right?

    By the way, I noticed that you are using __VMSIZE_H__ as the header inclusion guard identifier....
  7. Re: unsigned char* to string& being passed into function

    Good point, I overlooked the second argument to the constructor. However, the code is still wrong anyway, e.g., there's a memory leak due to a failure to match free with the malloc that was...
  8. Re: unsigned char* to string& being passed into function

    What are you trying to do in the Test function and why do you use malloc here in the first place? You basically allocated a block of memory of MAX_LENGTH bytes, failed to assign to it, then attempted...
  9. Re: global char type array initializing problem

    You initialised sqr in its definition. A definition is a declaration, so there is no problem.
  10. Re: global char type array initializing problem

    The problem is that you have non-declarative code outside of a function. Try:

    #include <iostream>
    using namespace std;

    char sqr[3];

    int main()
    {
    sqr[0] = '1';
  11. Re: Can one constructor of a class call another constructor of the same class

    What do you mean?
  12. Re: Can one constructor of a class call another constructor of the same class

    No, it isn't: you are looking at output that has no bearing on the member data of the object named a, i.e., it is output from the constructor that creates the temporary object that we have been...
  13. Re: Datatype Trouble In My Password Guessing Program

    Yes, but repetition is allowed. Basically, this is a program to generate password guesses for brute force cracking, though for experimental purposes the actual step of hashing or otherwise...
  14. Re: Datatype Trouble In My Password Guessing Program

    If it is a batch, then I would expect you to return a container (e.g., std::vector<std::string>) of password guesses of the given length, not a single password guess, and certainly not a char.

    ...
  15. Re: Can one constructor of a class call another constructor of the same class

    Perhaps you should make your constructors do a bit more work and observe the results:

    #include <iostream>

    class A
    {
    public:
    A(int x, char c);
    A(int x);
  16. Re: Datatype Trouble In My Password Guessing Program

    If that is a problem, then declare the variable before the loop.


    That is obvious: I noted that "it looks like you are trying to treat each possible password length separately". In other words,...
  17. Re: Can one constructor of a class call another constructor of the same class

    2kaud has addressed what is problematic with your code despite it compiling. That said, since C++11, the answer is yes, using a delegating constructor, e.g.,

    class A
    {
    public:
    A(int x, char...
  18. Re: Datatype Trouble In My Password Guessing Program

    What is your logic? That is, what is the algorithm that you have in mind?


    Sorry, but I don't see what is the problem. You can always declare currChar to be local, then pass it around, possibly...
  19. Re: Datatype Trouble In My Password Guessing Program

    Yes, I gather that this is the idea. No problem. The thing is, are you trying to return from the function just one of the possible password guesses, or are you trying to return some kind of list of...
  20. Re: Datatype Trouble In My Password Guessing Program

    Basically, your guess is a string. It is not a "current character", which is what I presume currChar means, hence my suggestion of currentGuess is suitable.

    The thing most in need of fixing here...
  21. Re: Datatype Trouble In My Password Guessing Program

    If you have a string and want to compare the first character, then you just write: currChar == password[0]. If you want currChar to be a string, well, give it some other name, e.g., currentGuess.
    ...
  22. Re: Datatype Trouble In My Password Guessing Program

    Why is currChar a string instead of a char?
  23. Replies
    4
    Views
    231

    Re: how can i detect memory leaks?

    You could read Stroustrup's answer to the FAQ How do I deal with memory leaks? The direct answer to your question comes at the end of that entry, but if you are not already doing what was described...
  24. Replies
    24
    Views
    597

    Re: Functionality of a function?

    It sets the value of current to the value of current->next. In conceptual terms, the pointer is set to point to its next element, so if the pointer points to the last node, it will then become a null...
  25. Replies
    10
    Views
    440

    Re: A question regarding stack size

    There is also maximum recursion depth to consider. Just use an explicit stack, e.g., with the help of std::stack.
Results 1 to 25 of 2000
Page 1 of 80 1 2 3 4


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center