View Single Post
Join Date: Apr 2005
Posts: 16,329
Reputation: jbennet is a splendid one to behold jbennet is a splendid one to behold jbennet is a splendid one to behold jbennet is a splendid one to behold jbennet is a splendid one to behold jbennet is a splendid one to behold 
Solved Threads: 556
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Moderator

Re: Howmany byte is pointer?

 
0
  #8
Dec 1st, 2008
http://bytes.com/groups/c/216087-size-sizeof-pointer

The size of a pointer has to be consistent for a particular system. It is the reason for labeling a system as 32-bit, 64-bit, etc. The reason for having different types of pointers is for the allocation of memory at that particular location, and to help prevent buffer overflows when passing a pointer.
not nececerially. there is no default pointer size, just the actual size it is. If there were, it would imply that you could
somehow specify any size you wished. No mention of a default size is mentioned in the C spec.

There is no guarantee that all pointer types will have the same sizeeither (except in the case of pointers to structures and unions).

e.g an int* may be larger than a char*. This is particuarly true with regards to function pointers and data pointers, which are, for example, different sizes from each other in DOS depending on which memory model is used. For example, the AS/400 PS by IBM specifies additional informationb with regards to function pointers whioch can make it significantly bigger than an ordinary data pointer.

However, On most modern OS platforms and Compilers, all pointer types are of equal size and are reprsesneted in the same way on a low level.

In most cases, word length / register size of the processor (CPU) determines the size of a pointer which is generally 2 or 4 or 8 bytes for 16,32 and 64 bit CPUs respectively, but as i said, you should never assume this to always be the case. Thats why the size of a pointer determines the maximum memory that can be
addressed at once e.g the 4gb limit on 32 bit systems.
Last edited by jbennet; Dec 1st, 2008 at 12:09 pm.
http://cdn.battlefieldheroes.com/signatures/229198472/1Player profile at BattlefieldHeroes.com, Free Shooter Game
Reply With Quote