Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Re: Compatibility question

Reply
Thread Tools

Re: Compatibility question

 
 
Phil Carmody
Guest
Posts: n/a
 
      10-27-2012
Greg Martin <(E-Mail Removed)> writes:
> On 12-10-24 01:20 PM, Steve Thompson wrote:
> > On Tue, Oct 23, 2012 at 03:53:21PM -0700, Keith Thompson wrote:
> >> Steve Thompson <(E-Mail Removed)> writes:
> >>> On Tue, Oct 23, 2012 at 12:26:05PM -0700, Keith Thompson wrote:
> >>>> Steve Thompson <(E-Mail Removed)> writes:
> >>>>> On Mon, Oct 22, 2012 at 09:06:39PM +0100, Ben Bacarisse wrote:
> >>>> [...]
> >>>>>> Whatever goes on under the hood (and I'd dispute that 'a' is "really a
> >>>>>> pointer") it's much easier to learn a language in its own terms, at
> >>>>>> least as far as that's possible.
> >>>>>
> >>>>> Well, no. 'a' is never a pointer as such in the terms of the language
> >>>>> syntax, but its treatment by the compiler internally is nominally
> >>>>> equivalent to they way it handles a pointer, with the exception that
> >>>>> the language grammar forbids its use in the program text as a pointer.
> >>>>
> >>>> I don't believe that's true. Do you have some evidence that it is?
> >>>
> >>> The distinction is largely moot. In a practical sense, all variables
> >>> have a value which is stored somewhere. The compiler is making an
> >>> explicit use of a pointer when it does something with the value. The
> >>> problem is that "use" in this context may as well be referring to ether
> >>> or memory and there's no easy way of knowing which it is.
> >>
> >> When you say "explicit use of a pointer", do you mean that there's
> >> a pointer *object* somewhere, or are you talking about a pointer
> >> *value*, also known as an "address"?

> >
> > I suppose address is the better term, but that does not work for
> > registers.
> >

>
> I know I should stay out of this. It seems a bit of a train wreck but
> ... I strikes me that it does work for registers and points (bad
> choice of word I know) to a fundamental use of the word pointer. A
> register can hold either an address that points to a value or it can
> hold the value itself, should the value be the sort that fits.


Not always. An architecture can have registers that may only be used
as addresses and others which may not be used as addresses, there's no
obligation for all registers to be used for all purposes.

Phil
--
Regarding TSA regulations:
How are four small bottles of liquid different from one large bottle?
Because four bottles can hold the components of a binary liquid explosive,
whereas one big bottle can't. -- camperdave responding to MacAndrew on /.
 
Reply With Quote
 
 
 
 
Greg Martin
Guest
Posts: n/a
 
      10-27-2012

On 12-10-27 12:42 PM, Phil Carmody wrote:
> Greg Martin <(E-Mail Removed)> writes:


>>
>> I know I should stay out of this. It seems a bit of a train wreck but
>> ... I strikes me that it does work for registers and points (bad
>> choice of word I know) to a fundamental use of the word pointer. A
>> register can hold either an address that points to a value or it can
>> hold the value itself, should the value be the sort that fits.

>
> Not always. An architecture can have registers that may only be used
> as addresses and others which may not be used as addresses, there's no
> obligation for all registers to be used for all purposes.
>
> Phil
>


Quite true, I should have stipulated general registers as well since
some registers aren't used for either.

 
Reply With Quote
 
 
 
 
BartC
Guest
Posts: n/a
 
      10-27-2012
"Greg Martin" <(E-Mail Removed)> wrote in message
news:9oYis.2124$(E-Mail Removed)...
>
> On 12-10-27 12:42 PM, Phil Carmody wrote:
> > Greg Martin <(E-Mail Removed)> writes:

>


> >> A
> >> register can hold either an address that points to a value or it can
> >> hold the value itself, should the value be the sort that fits.

> >
> > Not always. An architecture can have registers that may only be used
> > as addresses and others which may not be used as addresses, there's no
> > obligation for all registers to be used for all purposes.
> >
> > Phil
> >

>
> Quite true, I should have stipulated general registers as well since some
> registers aren't used for either.


Addresses of variables were also mentioned. When these are register
variables, that means taking the address of a register, rather than a
register simply containing an address.

Register addresses are unusual. In any case I doubt whether C allows them.

--
Bartc

 
Reply With Quote
 
Joe Pfeiffer
Guest
Posts: n/a
 
      10-27-2012
Steve Thompson <(E-Mail Removed)> writes:

> On Fri, Oct 26, 2012 at 01:02:14PM +0100, Ben Bacarisse wrote:
>> Steve Thompson <(E-Mail Removed)> writes:
>> <snip>
>> > My meta-point was basically about the fact that (a) English terminology
>> > is overloaded, and not merely in relation to programming, and (b) that
>> > it is useful to think about software, compilers, and programming in
>> > general terms. There is probably something worthwhile to be had in
>> > examining the philosophy or metaphysics of computer software and
>> > programming. I think those who reflexively stomp on discussions that
>> > move beyond the confines of a single standard or methodology are in
>> > some way threatened by different ways of thinking about these
>> > subjects.

>>
>> Yes, that's possible, but sometimes Brave New Ideas are just wrong.
>>
>> Sometimes evidence that they are wrong comes directly from their
>> proponents, such as when you wrote that:
>>
>> "... conceptually 'a' is still a pointer to the data in the specific
>> structure identified by 'a'. I found it very confusing when I was
>> learning C."
>>
>> (This was in the context of a declaration like "struct point {
>> int x, y, z; } a;".)
>>
>> It's no wonder that you found it confusing: it's wrong. It's going to
>> be a hindrance to learning C to think of 'a' as a pointer when it
>> isn't one, even "conceptually".

>
> I agree that it isn't a pointer in C, but it is an identifier that is
> associated with the structure. With a less restrictive definition of
> 'pointer', it is and the implementation of its actual use in a program
> mimics the semantics of a C pointer, to a certain degree. Since I am
> not using a restrictive definition of 'pointer' in every instance
> where I use the term, I think my statements are logically coherent.
>
> If we're going to get hung up on the propriety of specific uses of
> language terminology, you are correct in suggesting that this line of
> discussion will be a train-wreck.


"But 'glory' doesn't mean 'a nice knock-down argument'," Alice
objected.

"When I use a word," Humpty Dumpty said, in rather a scornful tone, "it
means just what I choose it to mean—neither more nor less."

"The question is," said Alice, "whether you can make words mean so many
different things."

"The question is," said Humpty Dumpty, "which is to be master -- that's
all."
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      10-28-2012
"BartC" <(E-Mail Removed)> writes:
[...]
> Register addresses are unusual. In any case I doubt whether C allows them.


It doesn't. N1370 6.5.3.2:

Constraints

1 The operand of the unary & operator shall be either a function
designator, the result of a [] or unary * operator, or an lvalue
that designates an object that is not a bit-field and is not
declared with the register storage-class specifier.

Not that an object declared with the "register" keyword may or may
not actually be stored in a CPU register; likewise for an object
declared *without* the "register" keyword.

--
Keith Thompson (The_Other_Keith) http://www.velocityreviews.com/forums/(E-Mail Removed) <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"
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      10-28-2012
Keith Thompson <(E-Mail Removed)> writes:
> "BartC" <(E-Mail Removed)> writes:
> [...]
>> Register addresses are unusual. In any case I doubt whether C allows them.

>
> It doesn't. N1370 6.5.3.2:
>
> Constraints
>
> 1 The operand of the unary & operator shall be either a function
> designator, the result of a [] or unary * operator, or an lvalue
> that designates an object that is not a bit-field and is not
> declared with the register storage-class specifier.
>
> Not that an object declared with the "register" keyword may or may
> not actually be stored in a CPU register; likewise for an object
> declared *without* the "register" keyword.


Sorry, I meant *Note* than an object ...

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <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"
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      10-28-2012
Keith Thompson <(E-Mail Removed)> writes:
> Keith Thompson <(E-Mail Removed)> writes:
>> "BartC" <(E-Mail Removed)> writes:
>> [...]
>>> Register addresses are unusual. In any case I doubt whether C allows them.

>>
>> It doesn't. N1370 6.5.3.2:
>>
>> Constraints
>>
>> 1 The operand of the unary & operator shall be either a function
>> designator, the result of a [] or unary * operator, or an lvalue
>> that designates an object that is not a bit-field and is not
>> declared with the register storage-class specifier.
>>
>> Not that an object declared with the "register" keyword may or may
>> not actually be stored in a CPU register; likewise for an object
>> declared *without* the "register" keyword.

>
> Sorry, I meant *Note* than an object ...


I meant "Note *that* an object ..."

*sigh*

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <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"
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dell RAM compatibility question Jim Whitman Computer Support 3 10-26-2005 05:39 PM
memory compatibility question Sal221 Computer Support 1 05-11-2005 08:16 AM
Cross Browser compatibility question tom HTML 46 10-28-2004 05:20 PM
Canon 550EX Speedlite Flash Compatibility Question Jonathan Stryker Digital Photography 6 11-10-2003 02:08 PM
Browser compatibility question Raymond Lee HTML 8 10-15-2003 11:13 PM



Advertisments