Announcement

Collapse
No announcement yet.

Crazy Exception

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cliff Nichols
    replied
    Jules,
    Is it something that you can post the code (as-is)? I would like to toss my "ErrorHandler.inc" file at it and see what it logs as an error.

    I can raise errors tested for purposely, but looking to test with code that errors "appear" on their own (because I made a mistake in the code)

    Leave a comment:


  • Jules Marchildon
    replied
    Hi Paul,

    Thanks, that is exactly right on! I've been trying to chase down an earlier event that should have preset the value to 15...

    this is Borje's EDM32.INC edit control, I have a modified version of it, I'm stepping through all the mod's right now. This line is in the Size handler, so it iterates 2-3 times and the initial value is 0, ...for the virgin EDM32.INC, the intial value is 15, so I need to see what I did that screwed it up. I was thrown off by the fact compiled with PBWIN7 it supplies an initial value of 15, but not with PBWIN8 and later.

    Thx.
    Regards,
    Jules

    added later... problem fixed.
    original code included a test... IF @ed.charWidth = 0 OR @ed.charHeight = 0 THEN EXIT FUNCTION
    for some reason I omitted it in my modified version. Thanks for your help Paul !
    Last edited by Jules Marchildon; 5 Jul 2009, 01:00 PM.

    Leave a comment:


  • Paul Dixon
    replied
    Jules,
    if @ed.charHeight is zero or extremely small then the integer division will cause a Divide Exception as the reslut will be too large to fit the destination.
    The FP version won't give an exception regardless of the result.

    The third option you add 1 to @ed.charHeight before the divide so you're dividing by 1 instead of zero (or nearly 1 instead of very small).

    Check the value of @ed.charHeight before the divide and see what it is.

    Paul.

    Leave a comment:


  • Jules Marchildon
    started a topic Crazy Exception

    Crazy Exception

    I recompiled a large PBWIN7 project to PBWIN9 and came across something strange,
    more stranger then me!

    This line is the original code and uses an interger division that now causes an exception
    in my program when I execute this line of code...

    @ed.wnHeight = MAX&(1, (HIWRD(lParam) - sBarWidth) \ @ed.charHeight + 1)

    ...when I change to a floating point division, it works perfectly again.

    @ed.wnHeight = MAX&(1, (HIWRD(lParam) - sBarWidth) / @ed.charHeight + 1)

    ...and this also works perfectly.

    @ed.wnHeight = MAX&(1, (HIWRD(lParam) - sBarWidth) \ ( @ed.charHeight + 1 ) )

    Thx.
    Regards,
    Stumped and a little bit stupid...
    Last edited by Jules Marchildon; 5 Jul 2009, 07:19 AM.
Working...
X