Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #10320

Re: Address of array && address of pointer to array

From Nobody <nobody@nowhere.com>
Subject Re: Address of array && address of pointer to array
Date 2011-09-16 13:20 +0100
Message-Id <pan.2011.09.16.12.20.48.30000@nowhere.com>
Newsgroups comp.lang.c
References <285449fe-33f9-4c81-893d-1d9349da0e95@x11g2000prb.googlegroups.com> <0.043e10b933bc7ff0fade.20110914144111BST.87sjnzz1fs.fsf@bsb.me.uk> <a5df2719-174b-41e0-a39d-659878de44f3@h7g2000yqm.googlegroups.com> <lnvcst8wqv.fsf@nuthaus.mib.org> <3f7eeae9-902e-4d07-865a-9045fdc9159b@hg2g2000vbb.googlegroups.com>
Organization Zen Internet

Show all headers | View raw


On Thu, 15 Sep 2011 18:13:59 -0700, Stanley Rice wrote:

>> That's not guaranteed to work.  The behavior of converting a function
>> pointer to void* is not defined.
> 
> 
> <snip>
>> It's likely to work in practice (and I think POSIX requires it
>> to work), but there have been systems where function pointers are
>> bigger than void*, so the conversion could lose information.
> 
> I am not fully understand your meaning of "function pointers are
> bigger than void *". I know it's not the size of the pointer.

No, he means the size of the pointer itself.

Pointers don't have to all have the same size. The most common
counter-example is 8086 memory models.

The "medium" model has multiple code segements but a single data segment,
so a function pointer is 32 bits (segment + offset) while a data pointer
(including "void*") is 16 bits (offset only).

The "compact" model is the other way around (a single code segment but
multiple data segments).

A less common counter-example is word-addressed architectures, where a
pointer to a type smaller than a word must contain both the address of the
word and an offset within the word. Pointers to types as large as or
larger than a word don't require the offset.

Back to comp.lang.c | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Address of array && address of pointer to array Stanley Rice <heconghui@gmail.com> - 2011-09-14 06:12 -0700
  Re: Address of array && address of pointer to array Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-09-14 14:41 +0100
    Re: Address of array && address of pointer to array Paul N <gw7rib@aol.com> - 2011-09-14 14:15 -0700
    Re: Address of array && address of pointer to array Peter Nilsson <airia@acay.com.au> - 2011-09-14 19:25 -0700
      Re: Address of array && address of pointer to array Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-09-15 10:54 +0100
        Re: Address of array && address of pointer to array Stanley Rice <heconghui@gmail.com> - 2011-09-15 05:36 -0700
          Re: Address of array && address of pointer to array Ike Naar <ike@sverige.freeshell.org> - 2011-09-15 13:46 +0000
          Re: Address of array && address of pointer to array Nobody <nobody@nowhere.com> - 2011-09-15 14:48 +0100
            Re: Address of array && address of pointer to array Keith Thompson <kst-u@mib.org> - 2011-09-15 10:28 -0700
              Re: Address of array && address of pointer to array Stanley Rice <heconghui@gmail.com> - 2011-09-15 18:23 -0700
                Re: Address of array && address of pointer to array Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-09-16 12:58 +0100
                Re: Address of array && address of pointer to array James Kuyper <jameskuyper@verizon.net> - 2011-09-16 08:03 -0400
              Re: Address of array && address of pointer to array Nobody <nobody@nowhere.com> - 2011-09-16 13:09 +0100
                Re: Address of array && address of pointer to array Keith Thompson <kst-u@mib.org> - 2011-09-16 12:05 -0700
                Re: Address of array && address of pointer to array gazelle@shell.xmission.com (Kenny McCormack) - 2011-09-16 19:35 +0000
                Re: Address of array && address of pointer to array Peter Nilsson <airia@acay.com.au> - 2011-09-19 15:45 -0700
                Re: Address of array && address of pointer to array Keith Thompson <kst-u@mib.org> - 2011-09-19 17:47 -0700
          Re: Address of array && address of pointer to array James Kuyper <jameskuyper@verizon.net> - 2011-09-15 10:21 -0400
    Re: Address of array && address of pointer to array Stanley Rice <heconghui@gmail.com> - 2011-09-15 05:22 -0700
      Re: Address of array && address of pointer to array James Kuyper <jameskuyper@verizon.net> - 2011-09-15 10:23 -0400
        Re: Address of array && address of pointer to array pete <pfiland@mindspring.com> - 2011-09-15 15:26 -0400
          Re: Address of array && address of pointer to array Stanley Rice <heconghui@gmail.com> - 2011-09-15 18:14 -0700
            Re: Address of array && address of pointer to array Keith Thompson <kst-u@mib.org> - 2011-09-16 02:09 -0700
              Re: Address of array && address of pointer to array James Kuyper <jameskuyper@verizon.net> - 2011-09-16 08:39 -0400
              Re: Address of array && address of pointer to array pete <pfiland@mindspring.com> - 2011-09-16 18:08 -0400
            Re: Address of array && address of pointer to array Bart van Ingen Schenau <bart@ingen.ddns.info> - 2011-09-16 16:38 +0200
              Re: Address of array && address of pointer to array cri@tiac.net (Richard Harter) - 2011-09-16 22:04 +0000
          Re: Address of array && address of pointer to array Stanley Rice <heconghui@gmail.com> - 2011-09-15 18:08 -0700
            Re: Address of array && address of pointer to array Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-09-16 13:12 +0100
            Re: Address of array && address of pointer to array James Kuyper <jameskuyper@verizon.net> - 2011-09-16 08:30 -0400
      Re: Address of array && address of pointer to array Keith Thompson <kst-u@mib.org> - 2011-09-15 11:51 -0700
        Re: Address of array && address of pointer to array Stanley Rice <heconghui@gmail.com> - 2011-09-15 18:13 -0700
          Re: Address of array && address of pointer to array James Kuyper <jameskuyper@verizon.net> - 2011-09-15 21:18 -0400
            Re: Address of array && address of pointer to array Stanley Rice <heconghui@gmail.com> - 2011-09-16 05:37 -0700
              Re: Address of array && address of pointer to array James Kuyper <jameskuyper@verizon.net> - 2011-09-16 09:46 -0400
              Re: Address of array && address of pointer to array Keith Thompson <kst-u@mib.org> - 2011-09-16 12:08 -0700
          Re: Address of array && address of pointer to array Nobody <nobody@nowhere.com> - 2011-09-16 13:20 +0100

csiph-web