pointer size depends on what

K

kumar

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
 
I

Ian Collins

kumar said:
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.
 
K

kumar

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.

thanx, now i got
bye
 
B

Barry Schwarz

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top