Here's some weird behavior I found in the CW R5 (P1 U1) compiler. 
(Warning: this is heavy duty C++...)

IF     you define a template function T

AND    template function T is declared 'inline'

AND    you call function T from within function F

AND    somewhere in function F you use a string literal S
       ("in quotes") but you don't even pass string S to
       function T or do anything with it

AND    you have PC Relative Strings enabled in the project,
       to make the bytes of string S get stored in the code
       segment, not the A5-relative data segment

THEN   the PC Relative Strings setting will be ignored, and 
       the bytes of string S will get stored in the data segment,
       which will crash the app in certain launch codes.

I'm preparing an official bug report with test code, but I wanted to
share this on the forum to see if this rings a bell for anybody.  I'm
calling it a bug since I can't imagine why a template instantiation
would require the PC Relative Strings setting to be disabled.

(The key here is the 'inline' attribute of the template function.  If
you remove the inline, all is well.)

-slj-

P.S. Despite the presence of a bug in the C++ compiler, we are _not_
going to consider switching to Smalltalk.  :-)

Reply via email to