Size of the pointer to a function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sanket
    New Member
    • Sep 2006
    • 1

    Size of the pointer to a function

    Hi ,


    What will be the size of the pointer to a function. Function is of type void.
  • pukur123
    New Member
    • Sep 2006
    • 61

    #2
    The size of any pointer C is same as the size of an unsigned integer.

    Comment

    • tyreld
      New Member
      • Sep 2006
      • 144

      #3
      Originally posted by pukur123
      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.

      Comment

      • neerajsathe
        New Member
        • Sep 2006
        • 2

        #4
        Yes...

        tyreld is right the size of pointers depend upon the platform...

        Comment

        • pukur123
          New Member
          • Sep 2006
          • 61

          #5
          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....

          Comment

          • r035198x
            MVP
            • Sep 2006
            • 13225

            #6
            Originally posted by pukur123
            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.htm l

            Comment

            • Banfa
              Recognized Expert Expert
              • Feb 2006
              • 9067

              #7
              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.

              Comment

              Working...