By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,084 Members | 1,956 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,084 IT Pros & Developers. It's quick & easy.

Size of the pointer to a function

P: 1
Hi ,


What will be the size of the pointer to a function. Function is of type void.
Sep 22 '06 #1
Share this Question
Share on Google+
6 Replies


P: 61
The size of any pointer C is same as the size of an unsigned integer.
Sep 22 '06 #2

100+
P: 144
The size of any pointer C is same as the size of an unsigned integer.
Not true. This is platform dependent. For example Linux uses unsinged long to represent pointer addresses.
Sep 22 '06 #3

P: 2
Yes...

tyreld is right the size of pointers depend upon the platform...
Sep 22 '06 #4

P: 61
Hi tyreld,

can you say in which distribution of linux the pointer takes the size of an unsigned long.

I am using RHEL3 and in this distribution I am not getting any difference between an unsigned int and unsigned long....
Sep 22 '06 #5

10K+
P: 13,264
Hi tyreld,

can you say in which distribution of linux the pointer takes the size of an unsigned long.

I am using RHEL3 and in this distribution I am not getting any difference between an unsigned int and unsigned long....
platform dependant

http://www.icce.rug.nl/documents/cplusplus/cplusplus15.html
Sep 22 '06 #6

Banfa
Expert Mod 5K+
P: 8,916
The C standard says nothing about pointer sizes and bit representations. It would be possible to have a completely valid implementation of C where pointers to different types has different sizes and/or bit representations and there have been platforms where this has been the case (not that I've used them).

A NULL pointer does not have to have the value 0x00000000 (please add the required number of zeros for your system). The standard states that it is the compielrs responsibility then it sees 0 (and NULL is normally just #define to 0) used in a pointer context (assignment or comparison) to assign to the pointer variable the platforms representation of an invalid pointer.


In 64 bit Windows pointers are 64 bits(surprise surprise) but ints (and longs for that matter) are still 32 bits.
Sep 22 '06 #7

Post your reply

Sign in to post your reply or Sign up for a free account.