#19 Sun Studio compiler doesn't like setting constants in header

closed-fixed
nobody
None
5
2008-03-18
2008-03-09
Brian Cameron
No

The Sun Studio compiler will not compile code that sets variables in headers via variables. The attached patch fixes the setting of mOutBufferSize to just be 284625 rather than 1.25 * mSamplesPerChunk + 7200. Since mSamplesPerChunk is set to 220500, the value will always be 284625. I added a comment to highlight how it is calculated.

Can this go upstream?

Discussion

  • Brian Cameron
    Brian Cameron
    2008-03-09

    patch fixing Sun Studio compile issue

     
  • Brian Cameron
    Brian Cameron
    2008-03-10

    Logged In: YES
    user_id=689771
    Originator: YES

    Actually, working with a co-worker, I found a better way to patch the code. In short, Sun Studio just doesn't like using float values (like 1.25) in setting integer constants. So doing the following (multiplying 1.25 by 100 and then diving the total by 100) also works and is perhaps better than just hardcoding to 284625

    + static const int mOutBufferSize =
    + int(((125 * mSamplesPerChunk) + 7200) / 100);

    So providing this updated patch for review.
    File Added: audacity-10-fixconstint.diff

     
  • Richard Ash
    Richard Ash
    2008-03-17

    Logged In: YES
    user_id=950206
    Originator: NO

    This code has changed in CVS head to use a different calculation, which is all integer arithmetic. If this is still a problem a new patch would be needed.

     
  • Brian Cameron
    Brian Cameron
    2008-03-18

    • status: open --> closed-fixed
     
  • Brian Cameron
    Brian Cameron
    2008-03-18

    Logged In: YES
    user_id=689771
    Originator: YES

    This is no longer a problem. The latest version of audacity compiles fine. No need to patch, or change the code. Closing this bug.