pointer size depends on what

Discussion in 'C Programming' started by kumar, May 26, 2008.

  1. kumar

    kumar Guest

    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
     
    kumar, May 26, 2008
    #1
    1. Advertising

  2. kumar

    Ian Collins Guest

    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.
     
    Ian Collins, May 26, 2008
    #2
    1. Advertising

  3. kumar

    kumar Guest

    On May 26, 2:02 pm, "Malcolm McLean" <> wrote:
    > "kumar" <> wrote 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
     
    kumar, May 26, 2008
    #3
  4. On Mon, 26 May 2008 00:31:30 -0700 (PDT), 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


    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
     
    Barry Schwarz, May 26, 2008
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. moo moo
    Replies:
    0
    Views:
    489
    moo moo
    Jul 21, 2003
  2. welsungo
    Replies:
    0
    Views:
    9,945
    welsungo
    Mar 5, 2005
  3. narke
    Replies:
    11
    Views:
    1,596
    narke
    Apr 22, 2005
  4. rbg
    Replies:
    1
    Views:
    423
    Jeeran
    Jul 3, 2006
  5. vigori
    Replies:
    0
    Views:
    270
    vigori
    Jan 5, 2005
Loading...

Share This Page