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


Groups > comp.lang.c > #27617

Re: Compatibility question

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: Compatibility question
Date 2012-10-23 20:06 -0700
Organization None to speak of
Message-ID <lnr4oovaar.fsf@nuthaus.mib.org> (permalink)
References (8 earlier) <ap54B1.hSk.bor8X@gmail.com> <lnr4opdm7m.fsf@nuthaus.mib.org> <VTQKnL.Au1.NMBnf@gmail.com> <lnzk3cvlzy.fsf@nuthaus.mib.org> <k67avm$o03$1@dont-email.me>

Show all headers | View raw


"BartC" <bc@freeuk.com> writes:
> "Keith Thompson" <kst-u@mib.org> wrote in message 
> news:lnzk3cvlzy.fsf@nuthaus.mib.org...
>> Steve Thompson <stevet810@gmail.com> writes:
>
>>> No, a char ** object is a pointer to a char ** object.
>>
>> Was that really what you meant to type?  I messed up the number of *s,
>> so I can hardly criticize you for doing the same thing, but I'd like to
>> know what you meant.
>>
>> In your model, as I understand it, an int object is really a pointer to
>> int, or an int*.  It would follow that a char** object is really a
>> pointer to a char**, or a char***.  Or am I misunderstanding you?
>>
>> In fact, an int object is an int object.  I find that so obvious
>> that it seems odd to have to state it.  For an operation on such
>> an object, a compiler might have to generate code that determines
>> that object's address.
>
> For every variable of type T, there will be an address of the variable of 
> type T* (at least, before compiler optimisation gets to work on it).

First, the word "variable" is a bit ambiguous.  Is it synonymous
with "object"?  Usually the meaning is clear enough, but in this
context it's important to be very clear what we're talking about --
and the standard provides no definition of the word "variable".

And what do you mean that "there will be" an address of the variable?
Given a declaration `some_type obj;` the expression &obj can be
evaluated, and is of type some_type* -- but are you saying there's some
sense in which that value exists somewhere just because the object
exists?

>                                                                      That 
> address (or pointer) will be a constant value though, just like the constant 
> 8258 is value of type int that doesn't need storage.

Depends on what you mean by "constant".  It cannot in general be
evaluated at compile time, as 8258 can.  It can be evaluated at link
time if the variable is an object with static storage duration,
but not if it has automatic storage duration.  And of course bit
fields and register objects don't have addresses.

>                                                      Such an address is also 
> automatically dereferenced by a HLL when you just write the name of the 
> variable; so the T* aspects of it get overlooked.

The expression `obj` refers to the object of that name.  I don't see
how it's useful to think of that expression as taking the address of
`obj` and then dereferencing that address.

> That's how you might get your char*** pointer from char**. Of course ST 
> might have been thinking of an implementation with an actual stored char*** 
> pointer, not a constant one, in which case the address of that, if his 
> language allows it, would be char****!

I suspect it's best to let ST explain what he means.

>>>> I think you're simply adding an extra -- and unnecessary -- level
>>>> of indirection, and of confusion.
(that was me)

> Whoever said that bit is right. I think a diagram is called for.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
    Will write code for food.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

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


Thread

Compatibility question Steve Thompson <stevet810@gmail.com> - 2012-10-20 03:08 +0000
  Re: Compatibility question Ian Collins <ian-news@hotmail.com> - 2012-10-20 16:20 +1300
    Re: Compatibility question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-10-20 11:50 +0100
      Re: Compatibility question Keith Thompson <kst-u@mib.org> - 2012-10-20 11:41 -0700
        Re: Compatibility question Steve Thompson <stevet810@gmail.com> - 2012-10-21 23:04 +0000
          Re: Compatibility question Barry Schwarz <schwarzb@dqel.com> - 2012-10-21 20:27 -0700
    Re: Compatibility question Steve Thompson <stevet810@gmail.com> - 2012-10-20 04:01 +0000
      Re: Compatibility question Ian Collins <ian-news@hotmail.com> - 2012-10-21 09:26 +1300
        Re: Compatibility question Steve Thompson <stevet810@gmail.com> - 2012-10-21 22:54 +0000
          Re: Compatibility question Ian Collins <ian-news@hotmail.com> - 2012-10-22 12:29 +1300
            Re: Compatibility question Steve Thompson <stevet810@gmail.com> - 2012-10-21 23:50 +0000
              Re: Compatibility question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-10-22 02:27 +0100
                Re: Compatibility question Steve Thompson <stevet810@gmail.com> - 2012-10-22 02:28 +0000
                Re: Compatibility question Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-10-22 11:18 -0400
                Re: Compatibility question Steve Thompson <stevet810@gmail.com> - 2012-10-22 16:19 +0000
                Re: Compatibility question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-10-22 17:37 +0100
                Re: Compatibility question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-10-22 17:40 +0100
                Re: Compatibility question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-10-22 17:30 +0100
                Re: Compatibility question Steve Thompson <stevet810@gmail.com> - 2012-10-22 17:23 +0000
                Re: Compatibility question Keith Thompson <kst-u@mib.org> - 2012-10-22 10:52 -0700
                Re: Compatibility question Steve Thompson <stevet810@gmail.com> - 2012-10-22 18:42 +0000
                Re: Compatibility question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-10-22 21:06 +0100
                Re: Compatibility question Steve Thompson <stevet810@gmail.com> - 2012-10-22 22:52 +0000
                Re: Compatibility question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-10-23 03:33 +0100
                Re: Compatibility question Steve Thompson <stevet810@gmail.com> - 2012-10-23 12:28 +0000
                Re: Compatibility question "BartC" <bc@freeuk.com> - 2012-10-23 16:45 +0100
                Re: Compatibility question Steve Thompson <stevet810@gmail.com> - 2012-10-23 17:53 +0000
                Re: Compatibility question Keith Thompson <kst-u@mib.org> - 2012-10-23 12:41 -0700
                Re: Compatibility question "BartC" <bc@freeuk.com> - 2012-10-23 21:28 +0100
                Re: Compatibility question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-10-23 20:57 +0100
                Re: Compatibility question Keith Thompson <kst-u@mib.org> - 2012-10-23 12:26 -0700
                Re: Compatibility question Steve Thompson <stevet810@gmail.com> - 2012-10-23 20:39 +0000
                Re: Compatibility question Keith Thompson <kst-u@mib.org> - 2012-10-23 15:53 -0700
                Re: Compatibility question "BartC" <bc@freeuk.com> - 2012-10-24 00:57 +0100
                Re: Compatibility question Keith Thompson <kst-u@mib.org> - 2012-10-23 20:06 -0700
                Re: Compatibility question "BartC" <bc@freeuk.com> - 2012-10-24 11:18 +0100
                Re: Compatibility question Keith Thompson <kst-u@mib.org> - 2012-10-24 12:04 -0700
                Re: Compatibility question "BartC" <bc@freeuk.com> - 2012-10-24 23:10 +0100
                Re: Compatibility question Keith Thompson <kst-u@mib.org> - 2012-10-24 16:58 -0700
                Re: Compatibility question "BartC" <bc@freeuk.com> - 2012-10-25 01:46 +0100
                Re: Compatibility question Keith Thompson <kst-u@mib.org> - 2012-10-24 19:40 -0700
                Re: Compatibility question Steve Thompson <stevet810@gmail.com> - 2012-10-24 20:20 +0000
                Re: Compatibility question Keith Thompson <kst-u@mib.org> - 2012-10-24 14:38 -0700
                Re: Compatibility question James Kuyper <jameskuyper@verizon.net> - 2012-10-24 17:55 -0400
                Re: Compatibility question Keith Thompson <kst-u@mib.org> - 2012-10-24 16:29 -0700
                Re: Compatibility question Greg Martin <greg@softsprocket.com> - 2012-10-24 15:21 -0700
                Re: Compatibility question Steve Thompson <stevet810@gmail.com> - 2012-10-26 03:30 +0000
                Re: Compatibility question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-10-26 13:02 +0100
                Re: Compatibility question Steve Thompson <stevet810@gmail.com> - 2012-10-27 00:04 +0000
                Re: Compatibility question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-10-27 20:15 +0100
                Re: Compatibility question Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2012-10-27 16:36 -0600
                Re: Compatibility question Steve Thompson <stevet810@gmail.com> - 2012-10-28 17:36 +0000
                Re: Compatibility question Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-10-27 22:42 +0300
                Re: Compatibility question Greg Martin <greg@softsprocket.com> - 2012-10-27 14:30 -0700
                Re: Compatibility question "BartC" <bc@freeuk.com> - 2012-10-27 22:57 +0100
                Re: Compatibility question Keith Thompson <kst-u@mib.org> - 2012-10-27 17:04 -0700
                Re: Compatibility question Keith Thompson <kst-u@mib.org> - 2012-10-27 17:14 -0700
                Re: Compatibility question Keith Thompson <kst-u@mib.org> - 2012-10-27 18:04 -0700
                Re: Compatibility question Keith Thompson <kst-u@mib.org> - 2012-10-24 16:46 -0700
                Re: Compatibility question Steve Thompson <stevet810@gmail.com> - 2012-10-25 01:18 +0000
                Re: Compatibility question Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-10-27 21:08 +0300
                Re: Compatibility question Steve Thompson <stevet810@gmail.com> - 2012-10-28 17:38 +0000
                Re: Compatibility question "BartC" <bc@freeuk.com> - 2012-10-23 00:38 +0100
                Re: Compatibility question Keith Thompson <kst-u@mib.org> - 2012-10-22 16:50 -0700
                Re: Compatibility question Steve Thompson <stevet810@gmail.com> - 2012-10-23 12:33 +0000
                Re: Compatibility question Öö Tiib <ootiib@hot.ee> - 2012-10-22 14:23 -0700
                Re: Compatibility question James Kuyper <jameskuyper@verizon.net> - 2012-10-22 17:26 -0400
                Re: Compatibility question Ian Collins <ian-news@hotmail.com> - 2012-10-23 10:55 +1300
                Re: Compatibility question Steve Thompson <stevet810@gmail.com> - 2012-10-22 23:27 +0000
                Re: Compatibility question "BartC" <bc@freeuk.com> - 2012-10-22 22:44 +0100
                Re: Compatibility question Les Cargill <lcargill99@comcast.com> - 2012-10-22 17:15 -0500
                Re: Compatibility question "BartC" <bc@freeuk.com> - 2012-10-23 00:13 +0100
                Re: Compatibility question James Kuyper <jameskuyper@verizon.net> - 2012-10-22 18:35 -0400
                Re: Compatibility question "BartC" <bc@freeuk.com> - 2012-10-23 00:14 +0100
                Re: Compatibility question Steve Thompson <stevet810@gmail.com> - 2012-10-22 23:42 +0000
                Re: Compatibility question Ian Collins <ian-news@hotmail.com> - 2012-10-23 13:35 +1300
                Re: Compatibility question Keith Thompson <kst-u@mib.org> - 2012-10-22 17:01 -0700
                Re: Compatibility question "BartC" <bc@freeuk.com> - 2012-10-23 01:47 +0100
              Re: Compatibility question Keith Thompson <kst-u@mib.org> - 2012-10-21 19:27 -0700

csiph-web