<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Pointer-to-function casting - C++ - tribe.net</title>
    <link>http://cpp.tribe.net/thread/85245e28-a47f-4122-b03e-42791eca8a95?format=rss</link>
    <description>Tribe.net. Local Connections</description>
    <item>
      <title>Re: Pointer-to-function casting</title>
      <link>http://CPP.tribe.net/thread/85245e28-a47f-4122-b03e-42791eca8a95#eb14bdb5-7021-4c55-a72b-1918557147c7</link>
      <description>As far as I know, casting a function pointer to a pointer has always yielded implementation-defined behavior. There are many platforms on which sizeof(function pointer) &gt; sizeof(void*) and on those platforms this code will crash when you try to cast back from void* and call through the function pointer.</description>
      <pubDate>Sun, 09 May 2004 07:19:01 GMT</pubDate>
      <guid isPermaLink="false">http://CPP.tribe.net/thread/85245e28-a47f-4122-b03e-42791eca8a95#eb14bdb5-7021-4c55-a72b-1918557147c7</guid>
      <dc:creator>Ben</dc:creator>
      <dc:date>2004-05-09T07:19:01Z</dc:date>
    </item>
    <item>
      <title>Re: Pointer-to-function casting</title>
      <link>http://CPP.tribe.net/thread/85245e28-a47f-4122-b03e-42791eca8a95#320d09b4-a370-4a44-938c-f7490f43177e</link>
      <description>It compiles but it's crap C++ coding.  It's even crap C coding.  There isn't a lot of justification for not typing it correctly.</description>
      <pubDate>Mon, 03 May 2004 04:45:40 GMT</pubDate>
      <guid isPermaLink="false">http://CPP.tribe.net/thread/85245e28-a47f-4122-b03e-42791eca8a95#320d09b4-a370-4a44-938c-f7490f43177e</guid>
      <dc:creator>Hypno</dc:creator>
      <dc:date>2004-05-03T04:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: Pointer-to-function casting</title>
      <link>http://CPP.tribe.net/thread/85245e28-a47f-4122-b03e-42791eca8a95#436a867a-b74e-456f-a14e-f24d690ee6e1</link>
      <description>My compiler (VS.NET) doesn't care. But it might change in the future releases. It's beter to start being careful about converting pointers to functions. In most cases it's as simple as using void(*)() instead of void* when an arbitrary function pointer may be used. &#xD;
And no, the strict reading of the standard doesn't allow any casting between void* and function pointer, even C-style casting.</description>
      <pubDate>Sun, 02 May 2004 20:10:58 GMT</pubDate>
      <guid isPermaLink="false">http://CPP.tribe.net/thread/85245e28-a47f-4122-b03e-42791eca8a95#436a867a-b74e-456f-a14e-f24d690ee6e1</guid>
      <dc:creator>Bartosz</dc:creator>
      <dc:date>2004-05-02T20:10:58Z</dc:date>
    </item>
    <item>
      <title>Pointer-to-function casting</title>
      <link>http://CPP.tribe.net/thread/85245e28-a47f-4122-b03e-42791eca8a95#12e35e17-29c5-4757-a276-b9595d79916b</link>
      <description>Do you thing the following is correct C++?&#xD;
&#xD;
int foo (char * str); // an arbitrary function&#xD;
void * p = foo; // store PTF as void *&#xD;
&#xD;
There is an interesting discussion about this at http://www.relisoft.com/forum/toast.asp?sub=show&amp;amp;action=posts&amp;amp;fid=5&amp;amp;tid=2827 .</description>
      <pubDate>Wed, 31 Mar 2004 16:29:05 GMT</pubDate>
      <guid isPermaLink="false">http://CPP.tribe.net/thread/85245e28-a47f-4122-b03e-42791eca8a95#12e35e17-29c5-4757-a276-b9595d79916b</guid>
      <dc:creator>Bartosz</dc:creator>
      <dc:date>2004-03-31T16:29:05Z</dc:date>
    </item>
    <item>
      <title>Re: Pointer-to-function casting</title>
      <link>http://CPP.tribe.net/thread/85245e28-a47f-4122-b03e-42791eca8a95#957a0c75-6975-481f-90d1-2463eb87ecd1</link>
      <description>I run across void * alot in external libraries that let me attach a reference to a created structure (this is usually C).  Motif is an example.  Usually the void * ptr was for the user to keep track of whatever he darn well wanted to.  The library designers didn't care.&#xD;
&#xD;
With that kind of catch all, I see no reason why void * could not point to a code address.  Will your compiler take it if you hard cast it (instead of using the C++ casting template?)</description>
      <pubDate>Sat, 24 Apr 2004 07:56:46 GMT</pubDate>
      <guid isPermaLink="false">http://CPP.tribe.net/thread/85245e28-a47f-4122-b03e-42791eca8a95#957a0c75-6975-481f-90d1-2463eb87ecd1</guid>
      <dc:creator>John</dc:creator>
      <dc:date>2004-04-24T07:56:46Z</dc:date>
    </item>
  </channel>
</rss>



