Return values - Just For Show?

From: Mike Nordell (tamlin@algonet.se)
Date: Sat Nov 23 2002 - 08:57:08 EST

  • Next message: F J Franklin: "commit: wv: correct initialization"

    Return values of type bool is not just for display, they are to be used. So
    what am I talking about? Well, what about SEGV?

    From fl_BlockLayout::StartList
        if(m_iDomDirection == FRIBIDI_TYPE_RTL)
         pStyle->getProperty((const XML_Char *) "margin-right", szAlign);
         else
         pStyle->getProperty((const XML_Char *) "margin-left", szAlign);

    When (not if, I've got a repeatable crash right here) getProperty returns
    false, it means the (completely uninitialized I might add) szAlign does not
    get set to anything. Later down we read:

      if (szAlign)
       fAlign = (float)UT_convertToInches(szAlign);

    Foot. Mouth. Chew carefully?

    It does have some strange zen-like tension though. The author of getProperty
    made sure to tell anyone using it whether it worked or not, and then the
    user of it completely disregards it.

    You want to try it yourself?
      Start a fresh AW.
      Click the button "Change dominant direction of paragraph".
      Click on Numbered List.
    Poof.

    /Mike



    This archive was generated by hypermail 2.1.4 : Sat Nov 23 2002 - 10:27:20 EST