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


Groups > comp.lang.c > #89621

Re: size of pointers to functions and size of pointer to data question

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.c
Subject Re: size of pointers to functions and size of pointer to data question
Date 2016-06-19 19:57 +0100
Organization A noiseless patient Spider
Message-ID <87eg7tqa69.fsf@bsb.me.uk> (permalink)
References <167656d7-b216-4a24-8b96-d73bf85e81aa@googlegroups.com> <lnziqjtvwm.fsf@kst-u.example.com> <nk6h86$teg$1@dont-email.me>

Show all headers | View raw


David Brown <david.brown@hesbynett.no> writes:

> On 17/06/16 22:14, Keith Thompson wrote:
>> G G <gdotone@gmail.com> writes:
>>> is the size of a pointer to a function the same size of a
>>> pointer to data on a given width of processor?
>>> 8 bit, 16 bit, 32 bit, 64 bit.
>>
>> Maybe.  (Incidentally, I don't believe a conforming implementation could
>> have 8-bit pointers, at least not a conforming hosted implementation.)
>
> I read that to mean "8-bit processor", rather than "8-bit wide pointers".
>
> These days, 8-bit processor almost always means "small embedded
> system" which means almost always means "free-standing" rather than
> "hosted" implementations.  And I /think/ 8-bit wide pointers should be
> allowed there (even though it is unusual for "int" to be wider than
> pointers).

I think it would go against the spirit of the standard.  For example, in
section 5.2.4.1 "Translation limits" it says the a conforming
implementation must be able to translate "at least one program that
contains at least one instance of..."

 -- 4095 characters in a string literal (after concatenation)
 
 -- 511 identifiers with block scope declared in one block

 -- 1023 members in a single structure or union

The bytes of the array that results from the string literal all need
distinct addresses, and if the identifiers name objects so do those
objects,, and if the structure can actually be used to declare an
instance of it, the members also need distinct addresses.  Of course
there is no requirement to be able to do anything with any of these
objects that would show that the addresses are distinct, but I would
argue that that is being very narrowly literal.

Mind you, if you are limited to 8-bit addresses you will be very happy
indeed to have an compiler that is almost but not quite conforming, so
it's really a non issue.

<snip>
-- 
Ben.

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


Thread

size of pointers to functions and size of pointer to data question G G <gdotone@gmail.com> - 2016-06-17 12:13 -0700
  Re: size of pointers to functions and size of pointer to data question supercat@casperkitty.com - 2016-06-17 12:24 -0700
  Re: size of pointers to functions and size of pointer to data question James Kuyper <jameskuyper@verizon.net> - 2016-06-17 16:06 -0400
    Re: size of pointers to functions and size of pointer to data question James Kuyper <jameskuyper@verizon.net> - 2016-06-17 16:18 -0400
      Hope springs eternal (Was: size of pointers to functions and size ...) question gazelle@shell.xmission.com (Kenny McCormack) - 2016-06-20 14:27 +0000
  Re: size of pointers to functions and size of pointer to data question Keith Thompson <kst-u@mib.org> - 2016-06-17 13:14 -0700
    Re: size of pointers to functions and size of pointer to data question David Brown <david.brown@hesbynett.no> - 2016-06-19 18:28 +0200
      Re: size of pointers to functions and size of pointer to data question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-06-19 19:57 +0100
        Re: size of pointers to functions and size of pointer to data question supercat@casperkitty.com - 2016-06-19 12:32 -0700
          Re: size of pointers to functions and size of pointer to data question Keith Thompson <kst-u@mib.org> - 2016-06-19 15:29 -0700
            Re: size of pointers to functions and size of pointer to data question supercat@casperkitty.com - 2016-06-20 08:57 -0700
  Re: size of pointers to functions and size of pointer to data question Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-06-17 16:49 -0400
    Re: size of pointers to functions and size of pointer to data question Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-06-17 16:54 -0400
      Re: size of pointers to functions and size of pointer to data question James Kuyper <jameskuyper@verizon.net> - 2016-06-17 17:15 -0400
        Re: size of pointers to functions and size of pointer to data question supercat@casperkitty.com - 2016-06-17 15:04 -0700
  Re: size of pointers to functions and size of pointer to data question Robert Wessel <robertwessel2@yahoo.com> - 2016-06-17 23:37 -0500

csiph-web