Note that there are some explanatory texts on larger screens.

plurals
  1. POFalse positive Error 503 for call to template function
    primarykey
    data
    text
    <p>I have some code that PC-Lint is giving me <a href="http://gimpel-online.com/MsgRef.html#503" rel="nofollow">Error 503: Boolean argument to relational</a> on. It is a call to a template function which is defined like this:</p> <pre><code>template &lt;typename ITypeToUse&gt; void ShowWindowEx( HWND hWnd, int nCmdShow, ITypeToUse *pControl); </code></pre> <p>The call itself looks like this:</p> <pre><code>ShowWindowEx&lt;IActualType&gt;(this-&gt;GetWndHandle(), SW_SHOW, m_spControl); </code></pre> <p>Appearantly, the part <code>ShowWindowEx&lt;IActualType&gt;(...)</code> is interpreted as <code>Identifier1 &lt; Identifier2 &gt; Expression</code>... PC-Lint seems not to be aware that <code>ShowWindowEx</code> is a template function which requires a type in angled brackets and tries its best to interpret it as a boolean expression.</p> <p>I am aware that I can simply tell lint to ignore this error for this line (though in reality it's about 30 lines), but I'd like to prevent this from happening again. Also, as far as I know, PC-Lint should be capable of handling template function calls, any idea why this is not the case here?</p> <p>The declaration is inside a class in a header and the call is in another member function of that class, which is declared right before ShowWindowEx is. The implementation of both member functions happens in the .cpp file in the same order, so the call to ShowWindowEx happens before its implementation. Is it possible PC-Lint just ignored the header?</p> <p>EDIT: I now changed the function prototype to:</p> <pre><code>template &lt;typename IPointerToUse&gt; void ShowWindowEx( HWND hWnd, int nCmdShow, IPointerToUse pControl); </code></pre> <p>So the template will take care of the type being a pointer. Thanks DeadMG for the suggestion. Question still stands, as I see no reason the above should not have worked, but it works this way as well.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload