<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:mikekaganski@hotmail.com" title="Mike Kaganski <mikekaganski@hotmail.com>"> <span class="fn">Mike Kaganski</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - BASIC VBASupport=1 erroneously inherited by StrComp() in module without VBASupport"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=132347">bug 132347</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Keywords</td>
           <td>
                
           </td>
           <td>difficultyMedium, easyHack, skillCpp
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - BASIC VBASupport=1 erroneously inherited by StrComp() in module without VBASupport"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=132347#c5">Comment # 5</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - BASIC VBASupport=1 erroneously inherited by StrComp() in module without VBASupport"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=132347">bug 132347</a>
              from <span class="vcard"><a class="email" href="mailto:mikekaganski@hotmail.com" title="Mike Kaganski <mikekaganski@hotmail.com>"> <span class="fn">Mike Kaganski</span></a>
</span></b>
        <pre>All over the place, the current compatibility mode is tested in the code like
this:

    SbiInstance* pInst = GetSbData()->pInst;
    bool bCompatibility = pInst && pInst->IsCompatibility();

But SbiInstance::IsCompatibility is ~useless, as it's set to some "random"
value (unrelated to the currently executed function, current module opened in
IDE, and even last built module).

Instead, the code should ask for *current module* to detect its compatibility
mode - and the proper method to find the current module seems to be
StarBASIC::GetActiveModule.

So the places like SbRtl_StrComp should use something like this:

    SbiInstance* pInst = GetSbData()->pInst;
    SbModule* pMod = StarBASIC::GetActiveModule();
    bool bCompatibility = pMod ? pMod->IsVBACompat() : pInst &&
pInst->IsCompatibility();

Whoever decides to fix the bug, should make sure to do that
function-by-function; and should provide unit tests for each such function.
This would require to create a mixed unit test, similar to what currently
basic/qa/cppunit/test_vba.cxx does, but its list of tests should possibly
contain pairs of source files (one with compat mode, one without) to load them
both, and test the resulting interaction.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>