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

Search:

Type: Posts; User: monarch_dodra

Page 1 of 80 1 2 3 4

Search: Search took 0.11 seconds.

  1. Re: error: expression must have a class type

    As a rule of thumb, prefer using "vector::data()" than "&vector[0]": It is more idiomatic in the sense that you use a function specifically designed explicitly for this use case. More importantly...
  2. Replies
    49
    Views
    995

    Re: .xml to .txt

    I usually just use tinyxml (http://www.grinninglizard.com/tinyxml/). It is a very lightweight, easy to install and very simple to use. It doesn't have a ton of features: you just give it an xml...
  3. Re: Dequeuing Integer Values From Heap Results In Garbage Values

    Do yourself a favor and Learn to use a debugger. The debugger would have told you that faster than it took you to copy paste your code here.
  4. Re: If I run the same program twice under linux

    Pretty sure that "If I run the same program twice under linux", then nothing will be shared in memory.
  5. Replies
    12
    Views
    457

    Re: Basic operator overloading

    These are good reading, but (IMO), both fail to recognize that having (certain) functions as members is simply convenient from a user's point of view. Just because you can, doesn't always mean you...
  6. Replies
    12
    Views
    457

    Re: Basic operator overloading

    For operator=, checking for that this and the right hand side are the same is usually a good idea. But if you can write your code in such a way that it does not matter, that's equally good. Also, for...
  7. Replies
    12
    Views
    457

    Re: Basic operator overloading

    This should be pretty trivial. Just make them return a reference "vmSize&", and at the end of your function, return a reference to this "return *this". That's really all there is to it:


    vmSize&...
  8. Replies
    12
    Views
    457

    Re: Basic operator overloading

    The usual standard practice is to make binary operators non-member fields. In this case it does no change much (if at all), just know this exists.

    Also, from a style point of view, in C++ the...
  9. Re: unsigned char* to string& being passed into function

    I have to disagree with this answer. The memory block itself is assigned to msg, and valid (though its contents are rubish, yes).

    Even then, string has a constructor that takes a buffer, and a...
  10. Replies
    17
    Views
    551

    Re: Working with fractions

    The design of your sum is wrong. It should return a new fraction "Fraction sum(Fraction a, Fraction b)", and then you want to print *that*. For example:


    sum(a, b).proper();
    // or
    Fraction c =...
  11. Replies
    36
    Views
    1,494

    Re: Seeding a C++11 random

    I mean that C has a "ready to use" global PRNG that you only need to seed once for the global application. C++11 has a lot of PRNG *types* but no global PRNG for sharing.



    That is a good...
  12. Replies
    36
    Views
    1,494

    Seeding a C++11 random

    I was wondering if there was a recommendation in regards to seeding C++11 randoms.

    The thing is that C-rand can be seeded with time, as it is a global random that only gets seeded once (though...
  13. Replies
    24
    Views
    711

    Re: Functionality of a function?

    Honestly, no. Please ask a clear question, so that we can provide a clear answer.

    You mentioned insertAsFirstElement so I will take a look at that.

    Also, please put your code in
    tags, to...
  14. Re: Need help allocatig memory for vectorized 2D array

    The fact that it is called "C, C++ tutorial" is already a telltale sign...
  15. Re: Need help allocatig memory for vectorized 2D array

    Yeah, the take home point here is that "[][]" is a bad idea. "(x, y)" (or "get(x ,y)" if you don't like operator()) is the way to go.

    An argument in favour of "[]" is that it could return an...
  16. Replies
    4
    Views
    383

    Re: Error 127 - Process not found

    If your error is "Error 127 - Process not found", the it is not a C++ problem, but an environment/program problem. There is absolutely nothing wrong with your program, which should work as-is....
  17. Replies
    6
    Views
    419

    Re: Variable declaration syntax?

    Actually, we should now prefer uniform initialization, and possibly, the "almost always auto" anitialization.
  18. Re: Handing more than one exception at a time

    Yes, it did not disprove the UB. It did disprove the "If you do it anyways, it terminates". Which was kind of my point that both statements are contradictory (you can't have UB if the standard...
  19. Re: Handing more than one exception at a time

    Wait what? since when? That's news to me. Are you sure about this? AFAIK, you just *shouldn't* throw exceptions in destructors. Do you have any references for that?

    If you do it anyway, and it...
  20. Re: cast Base class pointer to derived class pointer: when will this fail

    Agreed. But when all that is said and done, dynamic_cast is usually frowned upon and a good sign of code smell. As for private inheritance, while I understand the concept and use-case, I have NEVER...
  21. Re: cast Base class pointer to derived class pointer: when will this fail

    It doesn't really "work". It just appears to work. The cast is illegal, and you are in undefined behavior.

    The reason you *think* it works is because dif was *not* declared virtual, and as such...
  22. Replies
    6
    Views
    471

    Re: template operation issue

    I'm not sure what you mean by "recursively incomplete". The issue is rather that you will have multiple definition issues (since you are redefining it on a "per template instance" basis). As (kinda)...
  23. Replies
    19
    Views
    989

    Re: Why not C?

    This thread is so ridiculously off topic (and against TOS), that I don't know why any of us are still replying. Not only that, the actual question itself is vague beyond the possibility of any...
  24. Replies
    2
    Views
    301

    Re: RFC 2046: Mime types

    My first google result for "mime case sensitive" (http://stackoverflow.com/questions/12869278/are-mimetypes-lowercase-case-insensitive) seems to indicate that RFC 2045 states that (quoting quote from...
  25. Re: overriding base class template method

    Be careful. This is probably not what you wanted. I believe what you wanted here was to do a "specialization"? This is not what you did. What you did was declare a template parameterized on *a*...
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