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

Search:

Type: Posts; User: Paul McKenzie

Page 1 of 80 1 2 3 4

Search: Search took 3.45 seconds.

  1. Replies
    9
    Views
    2,145

    Re: Problem with empty/null string/char...

    Don't return a short int. Return a LONG. You should be returning and passing Windows API types, so that you don't get into the trouble where
    sizeof(Windows Type) != sizeof( C++ type )

    The...
  2. Replies
    10
    Views
    9,714

    Re: A simple vmString class

    One thing that your code lacks that I believe has not been mentioned is that the class lacks an assignment operator. Otherwise, you can't write code like this:


    vmString s1="x";
    vmString s2;...
  3. Re: How to initialize an array of DirectX9 Objects?

    1) Are you debugging a release build or a debug build?

    2) This:

    pMeshContainer->pBoneMatrices = new D3DXMATRIXA16[g_NumBoneMatricesMax];
    does not default initialize the members of the struct....
  4. Replies
    8
    Views
    5,032

    Re: Adding element into an n-ary Tree

    Why don't you use std::list instead of your home-made List class?

    Regards,

    Paul McKenzie
  5. Re: run-time check failure #0 - the value of ESP error with conversions

    1) Your read loop does not check if it goes over 500 entries.

    2) Why are you writing your own sort function, when you could use just std::sort?
    There is a big difference between "compiling fine"...
  6. Replies
    27
    Views
    4,511

    Re: why is this code crashing?

    One way to learn is to take the code I posted, compile it, and step through it with a debugger. You will see it gives you the correct results, all without loops. It almost uses no logic, except...
  7. Replies
    27
    Views
    4,511

    Re: why is this code crashing?

    Just for the heck of it, I coded this up. I won't go into how it works, since this is supposed to be homework.

    However, I posted it to illustrate what can be accomplished using the various...
  8. Replies
    27
    Views
    4,511

    Re: why is this code crashing?

    For example, here is a breakdown of cont1 and cont2, according to your description:


    cont1 = {4,34} {76,4} {3,5} {6,7} {67,19} {37,59} {38,33} {98,31} {12,19} {87,45}
    cont2 = {32} {98} {3} {55}...
  9. Replies
    27
    Views
    4,511

    Re: why is this code crashing?

    So take that data you posted -- what should the output be? Even better, show us with a smaller sample.

    Regards,

    Paul McKenzie
  10. Replies
    27
    Views
    4,511

    Re: why is this code crashing?

    You need to clarify what is meant by "repeating". You have a pair of numbers -- by "repeating" are you talking about the two numbers in the pair? Or pairs that have the same data? See the...
  11. Replies
    27
    Views
    4,511

    Re: why is this code crashing?

    for (chk2 = cont3.begin(); chk2 != cont3.end(); chk2++)
    That one line of code shows that chk2 does refer to the cont3 vector. It is an iterator into that vector. The replacing function messes up...
  12. Replies
    27
    Views
    4,511

    Re: why is this code crashing?

    Another thing you should do -- start out with 5 or 10 numbers, not 50. That way, bugs can be easily worked out with a smaller set of input values.

    Regards,

    Paul McKenzie
  13. Replies
    27
    Views
    4,511

    Re: why is this code crashing?

    One thing I see that is clearly wrong is that you're changing a vector while you're using iterators from that vector to loop.

    for (chk2 = cont3.begin() ; chk2 != cont3.end(); chk2 ++)
    ...
  14. Replies
    27
    Views
    4,511

    Re: why is this code crashing?

    Run the program under the debugger -- that is what anyone here would do to solve the problem, so you must learn how to do this. Now would be a good time to learn.

    Also, just because a program...
  15. Re: How to handle the exceptions that couldn't be caught by try/catch?

    Division by 0 is not a standard C++ exception, so there is nothing to "catch" since nothing is thrown.

    Regards,

    Paul McKenzie
  16. Replies
    5
    Views
    2,088

    Re: dynamic array resizing

    Honestly, your assignment doesn't make sense, even if you can't use vector.

    You're creating a dynamic array in main, but then you just call resize() which basically boils down to doing nothing. ...
  17. Re: What could cause a core dump at iterator pre increment??

    Unless it is a container such as std::map, you should strive to not erase elements in a container while you're looping over the same container. I have seen too many code examples where the coder is...
  18. Replies
    18
    Views
    5,483

    Re: How to use set?

    It does not free the memory that you allocated.

    Ask yourself this -- how would a std::set<char*> know that the pointer that is there points to dynamically allocated memory? It doesn't know.
    ...
  19. Re: pointer-to-member array crashes with virtual inheritance

    From 4.11.2 of the ANSI standard:


    Regards,

    Paul McKenzie
  20. Re: pointer-to-member array crashes with virtual inheritance

    Doesn't compile here:

    http://ideone.com/TbDZg2

    Regards,

    Paul McKenzie
  21. Replies
    7
    Views
    2,584

    Re: Math Doesn't Match

    Please post the output you're getting now, plus the input you're using.

    Second, just to warn you -- floating point calculations when done on a binary-based system such as a computer will not be...
  22. Replies
    3
    Views
    3,212

    Re: How to debug Win32 Message Loop?

    I highly recommend you use a dual monitor for debugging GUI issues, where Visual Studio is on one monitor, and your application is on the other monitor. Or get a very large monitor and...
  23. Re: STL functions shows a segmentation fault.

    If a static library is built with _SECURE_SCL=0, the all libraries that link to it that use STL must be built with the same setting.

    As to your code "working" on OS and not another machine --...
  24. Re: A question regarding throwing an exception

    It isn't just a "good practice". You cannot allow exceptions to leave a destructor, period. Therefore you have no choice but to catch anything before the destructor completes.
  25. Re: Can two functions in same DLL be called by two threads?

    How are you suspending the thread? If you're using SuspendThread, that shouldn't be used for synchronization.

    http://msdn.microsoft.com/en-us/library/windows/desktop/ms686345%28v=vs.85%29.aspx
    ...
Results 1 to 25 of 2000
Page 1 of 80 1 2 3 4





Click Here to Expand Forum to Full Width

Featured