Is void* compatible with function pointers?

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 24 12:00:30 PDT 2014


On 6/23/2014 1:30 PM, Ali Çehreli wrote:
> In C and C++, void* is for data pointers but it works (by accident?) for
> function pointers on all popular platforms.

For 16 bit programs, function pointers can be different sizes from data 
pointers. But D doesn't support 16 bit programming, and I know of no 32+ bit 
platform that does this.

It is possible to put the x86 in a mode with 48 bit function pointers, but so 
far as I know no C compiler allows that anyway.


> Does D have anything to say about this topic?

I'd say they were the same size. If, by some quirk, someone wants to port D to a 
platform where this was not true, they could certainly get it to work, but I 
don't think it is practical to burden the other 99.99999% with worrying about that.



More information about the Digitalmars-d mailing list