470,855 Members | 1,230 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,855 developers. It's quick & easy.

pointer size depends on what

how can i identefy the pointer size
means is taking 4 byte or 2 bytes , on what basis we can decide either
on processor or register
Jun 27 '08 #1
4 1908
kumar wrote:
how can i identefy the pointer size
means is taking 4 byte or 2 bytes , on what basis we can decide either
on processor or register
The question does not make a lot of sense, the sizeof operator will tell
you in code, or consult your compiler and platform documentation.

--
Ian Collins.
Jun 27 '08 #2

"kumar" <ra*******@gmail.comwrote in message
how can i identefy the pointer size
means is taking 4 byte or 2 bytes , on what basis we can decide either
on processor or register
It is just possible that different pointer types are different sizes, on
your system. Normally, however, a pointer is the size of an address
register, which means 16 bits on a 64K machine, 32 bits on a 4Gb machine,
and 64 bits on a large machine.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm
Jun 27 '08 #3
On May 26, 2:02 pm, "Malcolm McLean" <regniz...@btinternet.comwrote:
"kumar" <raman....@gmail.comwrote in message
how can i identefy the pointer size
means is taking 4 byte or 2 bytes , on what basis we can decide either
on processor or register

It is just possible that different pointer types are different sizes, on
your system. Normally, however, a pointer is the size of an address
register, which means 16 bits on a 64K machine, 32 bits on a 4Gb machine,
and 64 bits on a large machine.

--
Free games and programming goodies.http://www.personal.leeds.ac.uk/~bgy1mm
thanx, now i got
bye
Jun 27 '08 #4
On Mon, 26 May 2008 00:31:30 -0700 (PDT), kumar <ra*******@gmail.com>
wrote:
>how can i identefy the pointer size
means is taking 4 byte or 2 bytes , on what basis we can decide either
on processor or register
While processor type or register size may influence the compiler
writer to choose a size (or even different sizes), the writer is free
to choose any size as long as the compiler can generate the code to
correctly use that size. For example, many hardware systems use a
4-byte address. The compiler may use a 12-byte pointer and put range
checking information in the extra bytes. Once again, Compiler 1 need
not use the same approach as Compiler 2 and different versions of
Compiler 1 could use different approaches.

If you need to know before compiling, use the documentation for your
implementation. If your code needs to know, then use the sizeof
operator which will produce to the correct value every time.
Remove del for email
Jun 27 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Bryan Parkoff | last post: by
4 posts views Thread by Pushkar Pradhan | last post: by
79 posts views Thread by syntax | last post: by
9 posts views Thread by sangeetha | last post: by
33 posts views Thread by siliconwafer | last post: by
48 posts views Thread by yezi | last post: by
13 posts views Thread by william | last post: by
19 posts views Thread by =?iso-8859-1?b?VG9t4XMg0yBoyWlsaWRoZQ==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.