<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Function list doesn&#x27;t detect C functions that have function pointers in the argument list]]></title><description><![CDATA[<p dir="auto">This valid C function is not included in the list:<br />
void A( void( *call )( void )  )<br />
{</p>
<p dir="auto">}</p>
<p dir="auto">And this one is:<br />
void B( void  )<br />
{</p>
<p dir="auto">}</p>
<p dir="auto">There is a file functionList.xml that contains regex rules but the regex is already very long, I lack the knowledge to change it correctly.</p>
<p dir="auto">Anyone have any idea how to solve this, any C programmers having the same problem?</p>
<p dir="auto">Edit:</p>
<p dir="auto">Or this variant also isn’t detected:<br />
void C( int (*s)[10]  )<br />
{</p>
<p dir="auto">}</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/170/function-list-doesn-t-detect-c-functions-that-have-function-pointers-in-the-argument-list</link><generator>RSS for Node</generator><lastBuildDate>Thu, 11 Jun 2026 03:28:27 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/170.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 18 Jul 2015 19:42:34 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Function list doesn&#x27;t detect C functions that have function pointers in the argument list on Mon, 20 Jul 2015 18:38:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a></p>
<p dir="auto">The name of the function is complicated, so functionList should return complicated as the name.</p>
<p dir="auto">You can see it in action here:<a href="https://ideone.com/SmDmCF" rel="nofollow ugc">https://ideone.com/SmDmCF</a></p>
<p dir="auto">It doesn’t do anything useful since it is an example.</p>
<p dir="auto">Here is another example:</p>
<p dir="auto">float ( *GetPointer( int a ) )[10]<br />
{<br />
( void )a ;<br />
return NULL ;<br />
}</p>
<p dir="auto">This is a function named GetPointer, taking an int and returning a pointer to an array of 10 float.<br />
You can see it working here: <a href="https://ideone.com/Sxn8WQ" rel="nofollow ugc">https://ideone.com/Sxn8WQ</a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/556</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/556</guid><dc:creator><![CDATA[bri235445]]></dc:creator><pubDate>Mon, 20 Jul 2015 18:38:48 GMT</pubDate></item><item><title><![CDATA[Reply to Function list doesn&#x27;t detect C functions that have function pointers in the argument list on Mon, 20 Jul 2015 18:17:28 GMT]]></title><description><![CDATA[<p dir="auto">Hello <strong>bri235445</strong>,</p>
<p dir="auto">I intend to learn <strong>C/C++</strong> language, someday. But, I presently know <strong>very few</strong>, about these languages !</p>
<p dir="auto">However, in your <strong>previous</strong> post, didn’t you forget the <strong>name</strong> of the function ? I mean something like :</p>
<p dir="auto"><strong><code>void D( *complicated( int a ,....</code></strong>, instead of <strong><code>void( *complicated( int a ,....</code></strong></p>
<hr />
<p dir="auto">In case of a <strong>negative</strong> answer, can you tell me what <strong>name</strong> the <strong>functionList</strong> should return, in that <strong>specific</strong> case ?</p>
<p dir="auto">Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/555</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/555</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Mon, 20 Jul 2015 18:17:28 GMT</pubDate></item><item><title><![CDATA[Reply to Function list doesn&#x27;t detect C functions that have function pointers in the argument list on Sun, 19 Jul 2015 23:39:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a></p>
<p dir="auto">It is hard to test for false positives. Thus far I haven’t seen any.</p>
<p dir="auto">I have found an example that is a valid C function but it isn’t detected by your regex:</p>
<p dir="auto">void ( *complicated( int a , void( *f )( int ) ) ) ( int )<br />
{<br />
void( *b )( int ) = NULL ;<br />
return b ;<br />
}</p>
<p dir="auto">This is a function taking an int and a pointer to a function taking an int and returning nothing, returning a pointer to a function taking an int and returning nothing.</p>
<p dir="auto">This is not a common occurrence and actually writing such code is obnoxious. Nevertheless, can you make this work? :-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/536</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/536</guid><dc:creator><![CDATA[bri235445]]></dc:creator><pubDate>Sun, 19 Jul 2015 23:39:28 GMT</pubDate></item><item><title><![CDATA[Reply to Function list doesn&#x27;t detect C functions that have function pointers in the argument list on Sun, 19 Jul 2015 21:28:03 GMT]]></title><description><![CDATA[<p dir="auto">Hello <strong>bri235445</strong> and  <strong>Ricardo</strong>,</p>
<p dir="auto">The most important thing is that <strong>my</strong> regex version <em>doesn’t <strong>break</strong> anything else</em> !!</p>
<p dir="auto">As you’re certainly more acquainted with <strong>C/C++</strong> programs than me, it shouldn’t be very difficult, to you, to detect any <strong>additional</strong> problem :-)</p>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/533</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/533</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sun, 19 Jul 2015 21:28:03 GMT</pubDate></item><item><title><![CDATA[Reply to Function list doesn&#x27;t detect C functions that have function pointers in the argument list on Sun, 19 Jul 2015 14:09:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a></p>
<p dir="auto">Thank you for your reply. Your version does seem to work.</p>
<p dir="auto">Maybe this change could be added to future versions of Notepad++? Implementers should consider that C++ can have the same function definition thus that regex should be changed as well.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/520</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/520</guid><dc:creator><![CDATA[bri235445]]></dc:creator><pubDate>Sun, 19 Jul 2015 14:09:38 GMT</pubDate></item><item><title><![CDATA[Reply to Function list doesn&#x27;t detect C functions that have function pointers in the argument list on Sun, 19 Jul 2015 13:58:31 GMT]]></title><description><![CDATA[<p dir="auto">Hello <strong>bri235445</strong>, <strong>Ricardo</strong>, and <strong>All</strong>,</p>
<p dir="auto"><strong>Ricardo</strong>, you’re right ! the problem comes from the expression <strong><code>[^\)\(]*</code></strong> that means any sequence, even <strong>empty</strong>, of characters, different from <strong>round brackets</strong></p>
<p dir="auto">To match the special case of <strong>bri235445</strong> <strong><code>void A( void( *call )( void ) )</code></strong>, I changed that <strong>previous class</strong> character into  <strong><code>[\S ]*</code></strong></p>
<p dir="auto">Remember that the syntax <strong><code>\s</code></strong> is equivalent to the syntax <strong><code>[\t\n\x0B\f\r\x20\xA0]</code></strong></p>
<p dir="auto">=&gt; The syntax <strong><code>\S</code></strong>, with the <strong>uppercase</strong> letter <strong>s</strong>, means <strong><code>[^\t\n\x0B\f\r\x20\xA0]</code></strong></p>
<p dir="auto">So, my regex <strong><code>[\S ]*</code></strong> matches any sequence, even <strong>empty</strong>, of a <strong>NON</strong> blank character OR a <strong>space</strong></p>
<hr />
<p dir="auto">Then, knowing that :</p>
<ul>
<li>
<p dir="auto">The syntax <strong><code>\w</code></strong> does match the <strong>underscore</strong> <strong><code>_</code></strong></p>
</li>
<li>
<p dir="auto">The syntax <strong><code>[\s]</code></strong> can be simplified in <strong><code>\s</code></strong></p>
</li>
</ul>
<p dir="auto">=&gt; The <strong>mainExpr</strong> regex of the <strong>C</strong> parser, with my <strong>modification</strong>, could be simplified in :</p>
<pre><code>
^[\t ]*((static|const|virtual)\s+)?[\w:]+(\s+\w+)?(\s+|\*\s+|\s+\*|\s+\*\s+)(\w+\s*::)?(?!(if|while|for))\w+\s*\([\S ]*\)(\s*const\s*)?\s*\{
   
</code></pre>
<p dir="auto">Thus, <strong>bri235445</strong> :</p>
<ul>
<li>
<p dir="auto">Do a <strong>backup</strong> copy of the <strong>functionList.xml</strong> file</p>
</li>
<li>
<p dir="auto">Open the <strong>functionList.xml</strong> file, in N++</p>
</li>
<li>
<p dir="auto">Change, between the <strong>double</strong> quotes, the <strong>mainExpr</strong> regex, of the <strong>c_function</strong> parser, with the regex <strong>just above</strong></p>
</li>
<li>
<p dir="auto"><strong>Save</strong> the modifications. Then <strong>close</strong> and <strong>restart</strong> N++</p>
</li>
</ul>
<p dir="auto">=&gt; You should notice that you get the functions <strong>A</strong> and <strong>B</strong> in the <strong>Function List</strong> panel, with your text, in <strong>C</strong> language, that follows :</p>
<pre><code>void B( void )
{

}

void A( void( *call )( void ) )
{

}
</code></pre>
<p dir="auto">I tested with a portable <strong>v6.7.9.2</strong> version and everything works fine :-)</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
<p dir="auto"><strong>P.S.</strong> :</p>
<p dir="auto"><strong>Ricardo</strong>, your modification <strong><code>(.*)</code></strong> was nearly good :-)</p>
<p dir="auto">But it’s very <strong>important</strong> to remember that the <strong>Function List</strong> behaves, <em>by <strong>default</strong>, as the <strong>DOT</strong> stands for <strong>ANY</strong> character</em>, even the <strong>End of Line</strong> characters  !</p>
<p dir="auto">So, to <strong>restrict</strong> the matches of a <strong>dot</strong> to <strong>standard</strong> characters, <strong>only</strong>, the right syntax should be <strong><code>(?-s).*</code></strong>. I just suppress the <strong>round</strong> brackets, surrounding <strong>.*</strong>, as we don’t need any <strong>back-reference</strong> <strong><code>\1</code></strong></p>
<p dir="auto">It passes the test, too. However, I think that the syntax <strong><code>[\S ]*</code></strong>, being more <strong>restrictive</strong>, should be preferred</p>
]]></description><link>https://community.notepad-plus-plus.org/post/519</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/519</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sun, 19 Jul 2015 13:58:31 GMT</pubDate></item><item><title><![CDATA[Reply to Function list doesn&#x27;t detect C functions that have function pointers in the argument list on Sun, 19 Jul 2015 04:37:53 GMT]]></title><description><![CDATA[<p dir="auto">Hello,<br />
I’m also not good in regex, but I think here’s the problem:</p>
<pre><code class="language-xml">	&lt;function
	    mainExpr="^[\t ]*((static|const|virtual)[\s]+)?[\w]+([\s]+[\w]+)?([\s]+|\*[\s]+|[\s]+\*|[\s]+\*[\s]+)([\w_]+[\s]*::)?(?!(if|while|for))[\w_]+[\s]*\([^\)\(]*\)([\s]*const[\s]*)?[\n\s]*\{"
</code></pre>
<p dir="auto">Imo, the bad part is this: <code>\([^\)\(]*\)</code><br />
It means:</p>
<pre><code>\( matches the character ( literally

[^\)\(]* match a single character not present below (* Between zero and unlimited times)
    \) matches the character ) literally
    \( matches the character ( literally

\) matches the character ) literally
</code></pre>
<p dir="auto">But… I tried modifying with <code>\((.*)\)</code> so it matches anything inside parens, but it does not work in Np++…</p>
<p dir="auto">I also would like to know a solution.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/514</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/514</guid><dc:creator><![CDATA[Ricardo]]></dc:creator><pubDate>Sun, 19 Jul 2015 04:37:53 GMT</pubDate></item></channel></rss>