<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Classic/Legacy CodeWarriorのトピックHow to handle different functions with function pointers?</title>
    <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/How-to-handle-different-functions-with-function-pointers/m-p/148394#M1920</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #6633FF; font-family: 'Courier New';"&gt;In my program i need to handle different type of functions.I created some structure for accessing different functions.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000080;"&gt;&lt;STRONG style=": ; font-size: 2;"&gt;typedef&lt;/STRONG&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;struct&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;UCHAR&lt;/STRONG&gt; (&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN style="color: #0000ff;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;const&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN style="color: #000000;"&gt;GetFunc)(&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;void&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;SPAN style="color: #000000;"&gt;);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;SPAN style="color: #000000;"&gt;UCHAR_CPMTS;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;typedef&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;struct&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;UINT&lt;/STRONG&gt; (&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN style="color: #0000ff;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;const&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN style="color: #000000;"&gt;GetFunc)(&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;void&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;SPAN style="color: #000000;"&gt;);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;}&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;UINT_CPMTS;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000080;"&gt;&lt;STRONG style=": ; font-size: 2;"&gt;typedef&lt;/STRONG&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;&lt;SPAN style="color: #000080;"&gt;struct&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;SPAN style="color: #008080;"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;SPAN style="color: #000080;"&gt;void&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;SPAN style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN style="color: #0000ff;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;const&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;SPAN style="color: #000000;"&gt;SetFunc)(UCHAR);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;SPAN style="color: #000000;"&gt;UCHAR_CPMTS_INIT;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN style="color: #000080;"&gt;typedef&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;&lt;SPAN style="color: #000080;"&gt;struct&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;SPAN style="color: #008080;"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;SPAN style="color: #000080;"&gt;void&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;SPAN style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN style="color: #0000ff;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;const&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;SPAN style="color: #000000;"&gt;SetFunc)(UINT);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;}&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;UINT_CPMTS_INIT;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000080;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN style=": ; color: #000080;"&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000080;"&gt;&lt;STRONG&gt;&lt;SPAN style="color: #000080; font-size: 2;"&gt;static&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;&lt;SPAN style="color: #000080; font-size: 2;"&gt;const&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #000000; font-size: 2;"&gt;UCHAR_CPMTS UCHAR_GET_FUNC_LIST[]&lt;/SPAN&gt; &lt;STRONG&gt;&lt;SPAN style="color: #0000ff; font-size: 2;"&gt;=&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 2;"&gt;{&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000;"&gt;PROD_SPEC_UCHAR_GET_FUNC_LIST&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 2;"&gt;}&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 2;"&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN style="color: #000080; font-size: 2;"&gt;static&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;SPAN style="color: #000080; font-size: 2;"&gt;const&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN style="color: #000000; font-size: 2;"&gt;UINT_CPMTS UINT_GET_FUNC_LIST[]&lt;/SPAN&gt; &lt;STRONG&gt;&lt;SPAN style="color: #0000ff; font-size: 2;"&gt;=&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="color: #000000; font-size: 2;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 2;"&gt;{&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000;"&gt;PROD_SPEC_UINT_GET_FUNC_LIST&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 2;"&gt;}&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 2;"&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN style="color: #000080; font-size: 2;"&gt;static&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;SPAN style="color: #000080; font-size: 2;"&gt;const&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN style="color: #000000; font-size: 2;"&gt;UCHAR_CPMTS_INIT UCHAR_SET_FUNC_LIST[]&lt;/SPAN&gt; &lt;STRONG&gt;&lt;SPAN style="color: #0000ff; font-size: 2;"&gt;=&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="color: #000000; font-size: 2;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 2;"&gt;{&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000;"&gt;PROD_SPEC_UCHAR_SET_FUNC_LIST&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 2;"&gt;}&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 2;"&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN style="color: #000080; font-size: 2;"&gt;static&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;SPAN style="color: #000080; font-size: 2;"&gt;const&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN style="color: #000000; font-size: 2;"&gt;UINT_CPMTS_INIT UINT_SET_FUNC_LIST[]&lt;/SPAN&gt; &lt;STRONG&gt;&lt;SPAN style="color: #0000ff; font-size: 2;"&gt;=&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="color: #000000; font-size: 2;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 2;"&gt;{&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000;"&gt;PROD_SPEC_UINT_SET_FUNC_LIST&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 2;"&gt;}&lt;/SPAN&gt;&lt;SPAN style=": ; color: #000000; font-size: 2;"&gt;;&lt;/SPAN&gt;&lt;P&gt;&lt;SPAN style=": ; color: #ff0000; font-size: 2;"&gt;#define&lt;SPAN style=": ; color: #000000; font-size: 2;"&gt;PROD_SPEC_UCHAR_GET_FUNC_LIST&amp;nbsp; \&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #ff0000; font-size: 2;"&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; &lt;SPAN style=": ; color: #000000; font-size: 2;"&gt;GetButtonState&amp;nbsp;&amp;nbsp; \&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;NULL&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #ff0000; font-size: 2;"&gt;&lt;BR /&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 2;"&gt;using this pointers i can handle only&amp;nbsp; functions having uchar,uint return types and as arguements.But i need to handle SCHAR, as well as functions with more no of arguements.How to handle them in generic way,Instead of creating one structure for every fuction type.Please help me.I need the solution very urgent.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 2;"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; font-size: 2;"&gt;&lt;SPAN style="color: #000000;"&gt;Anuradha.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 Apr 2008 19:43:08 GMT</pubDate>
    <dc:creator>anunalge</dc:creator>
    <dc:date>2008-04-18T19:43:08Z</dc:date>
    <item>
      <title>How to handle different functions with function pointers?</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/How-to-handle-different-functions-with-function-pointers/m-p/148394#M1920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #6633FF; font-family: 'Courier New';"&gt;In my program i need to handle different type of functions.I created some structure for accessing different functions.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000080;"&gt;&lt;STRONG style=": ; font-size: 2;"&gt;typedef&lt;/STRONG&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;struct&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;UCHAR&lt;/STRONG&gt; (&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN style="color: #0000ff;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;const&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN style="color: #000000;"&gt;GetFunc)(&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;void&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;SPAN style="color: #000000;"&gt;);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;SPAN style="color: #000000;"&gt;UCHAR_CPMTS;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;typedef&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;struct&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;UINT&lt;/STRONG&gt; (&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN style="color: #0000ff;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;const&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN style="color: #000000;"&gt;GetFunc)(&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;void&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;SPAN style="color: #000000;"&gt;);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;}&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;UINT_CPMTS;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000080;"&gt;&lt;STRONG style=": ; font-size: 2;"&gt;typedef&lt;/STRONG&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;&lt;SPAN style="color: #000080;"&gt;struct&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;SPAN style="color: #008080;"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;SPAN style="color: #000080;"&gt;void&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;SPAN style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN style="color: #0000ff;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;const&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;SPAN style="color: #000000;"&gt;SetFunc)(UCHAR);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;SPAN style="color: #000000;"&gt;UCHAR_CPMTS_INIT;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN style="color: #000080;"&gt;typedef&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;STRONG&gt;&lt;SPAN style="color: #000080;"&gt;struct&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;SPAN style="color: #008080;"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;SPAN style="color: #000080;"&gt;void&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;SPAN style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN style="color: #0000ff;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;const&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;SPAN style="color: #000000;"&gt;SetFunc)(UINT);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;}&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;UINT_CPMTS_INIT;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000080;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN style=": ; color: #000080;"&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000080;"&gt;&lt;STRONG&gt;&lt;SPAN style="color: #000080; font-size: 2;"&gt;static&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;&lt;SPAN style="color: #000080; font-size: 2;"&gt;const&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #000000; font-size: 2;"&gt;UCHAR_CPMTS UCHAR_GET_FUNC_LIST[]&lt;/SPAN&gt; &lt;STRONG&gt;&lt;SPAN style="color: #0000ff; font-size: 2;"&gt;=&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 2;"&gt;{&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000;"&gt;PROD_SPEC_UCHAR_GET_FUNC_LIST&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 2;"&gt;}&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 2;"&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN style="color: #000080; font-size: 2;"&gt;static&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;SPAN style="color: #000080; font-size: 2;"&gt;const&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN style="color: #000000; font-size: 2;"&gt;UINT_CPMTS UINT_GET_FUNC_LIST[]&lt;/SPAN&gt; &lt;STRONG&gt;&lt;SPAN style="color: #0000ff; font-size: 2;"&gt;=&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="color: #000000; font-size: 2;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 2;"&gt;{&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000;"&gt;PROD_SPEC_UINT_GET_FUNC_LIST&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 2;"&gt;}&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 2;"&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN style="color: #000080; font-size: 2;"&gt;static&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;SPAN style="color: #000080; font-size: 2;"&gt;const&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN style="color: #000000; font-size: 2;"&gt;UCHAR_CPMTS_INIT UCHAR_SET_FUNC_LIST[]&lt;/SPAN&gt; &lt;STRONG&gt;&lt;SPAN style="color: #0000ff; font-size: 2;"&gt;=&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="color: #000000; font-size: 2;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 2;"&gt;{&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000;"&gt;PROD_SPEC_UCHAR_SET_FUNC_LIST&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 2;"&gt;}&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 2;"&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN style="color: #000080; font-size: 2;"&gt;static&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;SPAN style="color: #000080; font-size: 2;"&gt;const&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN style="color: #000000; font-size: 2;"&gt;UINT_CPMTS_INIT UINT_SET_FUNC_LIST[]&lt;/SPAN&gt; &lt;STRONG&gt;&lt;SPAN style="color: #0000ff; font-size: 2;"&gt;=&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="color: #000000; font-size: 2;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 2;"&gt;{&lt;/SPAN&gt;&lt;SPAN style="font-size: 2;"&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000;"&gt;PROD_SPEC_UINT_SET_FUNC_LIST&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 2;"&gt;}&lt;/SPAN&gt;&lt;SPAN style=": ; color: #000000; font-size: 2;"&gt;;&lt;/SPAN&gt;&lt;P&gt;&lt;SPAN style=": ; color: #ff0000; font-size: 2;"&gt;#define&lt;SPAN style=": ; color: #000000; font-size: 2;"&gt;PROD_SPEC_UCHAR_GET_FUNC_LIST&amp;nbsp; \&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #ff0000; font-size: 2;"&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; &lt;SPAN style=": ; color: #000000; font-size: 2;"&gt;GetButtonState&amp;nbsp;&amp;nbsp; \&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;NULL&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #ff0000; font-size: 2;"&gt;&lt;BR /&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 2;"&gt;using this pointers i can handle only&amp;nbsp; functions having uchar,uint return types and as arguements.But i need to handle SCHAR, as well as functions with more no of arguements.How to handle them in generic way,Instead of creating one structure for every fuction type.Please help me.I need the solution very urgent.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 2;"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; font-size: 2;"&gt;&lt;SPAN style="color: #000000;"&gt;Anuradha.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Apr 2008 19:43:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/How-to-handle-different-functions-with-function-pointers/m-p/148394#M1920</guid>
      <dc:creator>anunalge</dc:creator>
      <dc:date>2008-04-18T19:43:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle different functions with function pointers?</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/How-to-handle-different-functions-with-function-pointers/m-p/148395#M1921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Not sure what the setup will be used for.&lt;BR /&gt;In general, any special reason why using structs containing function pointers, and not just function pointers?&lt;BR /&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT color="#000080"&gt;&lt;FONT color="#000080"&gt;&lt;FONT size="2"&gt;&lt;B&gt;&lt;FONT color="#000080"&gt;&lt;BR /&gt;typedef&lt;/FONT&gt;&lt;/B&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT color="#000000"&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT color="#000080"&gt;&lt;FONT color="#000080"&gt;&lt;FONT size="2"&gt;&lt;FONT color="#000000"&gt;UINT&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT color="#000080"&gt;&lt;FONT color="#000080"&gt;&lt;FONT size="2"&gt;&lt;FONT color="#000000"&gt;(&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff"&gt;*&lt;/FONT&gt;&lt;FONT color="#000080"&gt;const&lt;/FONT&gt;&lt;/B&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT color="#000000"&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT color="#000080"&gt;&lt;FONT color="#000080"&gt;&lt;FONT size="2"&gt;&lt;FONT color="#000000"&gt;UINT_CPMTS_INIT&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT&gt;&lt;FONT&gt;&lt;FONT color="#000080"&gt;&lt;FONT color="#000080"&gt;&lt;FONT size="2"&gt;&lt;FONT color="#000000"&gt;)(UINT);&lt;BR /&gt;&lt;BR /&gt;Also is it necessary to support all different kinds of prototypes (signed char, unsigned char, int,...), can not a combined one, taking a larger type as UINT serve for all the smaller cases too?&lt;BR /&gt;&lt;BR /&gt;Also what are the operations on those arrays, maybe using a dedicated function which does the dispatching in code (instead of a data driven way) can handle the cases too.&lt;BR /&gt;&lt;BR /&gt;Daniel&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Apr 2008 21:40:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/How-to-handle-different-functions-with-function-pointers/m-p/148395#M1921</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2008-04-18T21:40:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle different functions with function pointers?</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/How-to-handle-different-functions-with-function-pointers/m-p/148396#M1922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;typedef void(FuncType)(void);
typedef int(AnotherFuncType)(void);
typedef void(YetAnotherFuncType)(int);

typedef union
{
  struct
  {
    FuncType func1;
    AnotherFuncType func2;
    YetAnotherFuncType func3;
  };

  FuncType func_array[3];

} FuncTypeContainer;


void func_a (void);
int  func_b (void);
void func_c (int x);

FuncTypeContainer ftc;
ftc.func_array =
{
  (void*)func_a,
  (void*)func_b,
  (void*)func_c
};

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;The above is flexible and will work flawlessly on Codewarrior (as long as you don't place functions in banked memory etc, then you will have to adapt the program to that with far pointers or similar). However, there are some important things you need to be aware of:&lt;BR /&gt;&lt;BR /&gt;You can't call the functions through the func_array. You must call them through their individual function name or you are invoking undefined behavior. Function pointer typecasts will work perfectly on CW, but they are undefined behavior in ISO C so the code will not be portable if you do that.&lt;BR /&gt;&lt;BR /&gt;Also, the code won't work on compilers using struct padding, which might also make it non-portable.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 08:50:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/How-to-handle-different-functions-with-function-pointers/m-p/148396#M1922</guid>
      <dc:creator>Lundin</dc:creator>
      <dc:date>2020-10-29T08:50:10Z</dc:date>
    </item>
  </channel>
</rss>

