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


Groups > comp.lang.c > #24661 > unrolled thread

dereference

Started by"Bill Cunningham" <nospam@nspam.invalid>
First post2012-08-20 18:04 -0400
Last post2012-08-21 16:12 -0400
Articles 20 on this page of 66 — 14 participants

Back to article view | Back to comp.lang.c


Contents

  dereference "Bill Cunningham" <nospam@nspam.invalid> - 2012-08-20 18:04 -0400
    Re: dereference Keith Thompson <kst-u@mib.org> - 2012-08-20 15:30 -0700
      Re: dereference "Bill Cunningham" <nospam@nspam.invalid> - 2012-08-20 18:37 -0400
        Re: dereference Keith Thompson <kst-u@mib.org> - 2012-08-20 18:43 -0700
        Re: dereference Kenneth Brody <kenbrody@spamcop.net> - 2012-08-22 14:42 -0400
          Re: dereference Keith Thompson <kst-u@mib.org> - 2012-08-22 12:10 -0700
            Re: dereference Kenneth Brody <kenbrody@spamcop.net> - 2012-08-22 17:38 -0400
      Re: dereference "Bill Cunningham" <nospam@nspam.invalid> - 2012-08-20 21:09 -0400
        Re: dereference Keith Thompson <kst-u@mib.org> - 2012-08-20 18:46 -0700
          Re: dereference "Bill Cunningham" <nospam@nspam.invalid> - 2012-08-21 16:15 -0400
          Re: dereference "Bill Cunningham" <nospam@nspam.invalid> - 2012-08-21 16:26 -0400
        Re: dereference Kenneth Brody <kenbrody@spamcop.net> - 2012-08-22 14:49 -0400
          Re: dereference "Bill Cunningham" <nospam@nspam.invalid> - 2012-08-22 18:10 -0400
            Re: dereference Barry Schwarz <schwarzb@dqel.com> - 2012-08-22 17:36 -0700
              Re: dereference "Bill Cunningham" <nospam@nspam.invalid> - 2012-08-22 20:50 -0400
                Re: dereference Keith Thompson <kst-u@mib.org> - 2012-08-22 17:54 -0700
                  Re: dereference "Bill Cunningham" <nospam@nspam.invalid> - 2012-08-22 21:23 -0400
                  Re: dereference "Bill Cunningham" <nospam@nspam.invalid> - 2012-08-22 21:26 -0400
                    Re: dereference Kenneth Brody <kenbrody@spamcop.net> - 2012-08-23 12:55 -0400
                      Re: dereference Mark Bluemel <mark_bluemel@pobox.com> - 2012-08-24 08:05 +0100
                    Re: dereference Hans Vlems <hvlems@freenet.de> - 2012-08-24 03:00 -0700
                      Re: dereference Kenneth Brody <kenbrody@spamcop.net> - 2012-08-24 13:31 -0400
                        Re: dereference "Bill Cunningham" <nospam@nspam.invalid> - 2012-08-24 17:20 -0400
                        Re: dereference "Bill Cunningham" <nospam@nspam.invalid> - 2012-08-24 19:36 -0400
                          Re: dereference Adrian Ratnapala <adrian.ratnapala@gmail.com> - 2012-08-24 20:42 -0700
                            Re: dereference Hans Vlems <hvlems@freenet.de> - 2012-08-27 00:11 -0700
                              Re: dereference Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-08-27 02:01 -0700
                                Re: dereference Keith Thompson <kst-u@mib.org> - 2012-08-27 03:24 -0700
                          Re: dereference Barry Schwarz <schwarzb@dqel.com> - 2012-08-24 21:44 -0700
                            Re: dereference "Bill Cunningham" <nospam@nspam.invalid> - 2012-08-25 09:46 -0400
                              Re: dereference Vincenzo Mercuri <vincenzo.mercuri@yahoo.it> - 2012-08-25 16:22 +0200
                              Re: dereference Vincenzo Mercuri <vincenzo.mercuri@yahoo.it> - 2012-08-25 16:33 +0200
                              Re: dereference Adrian Ratnapala <adrian.ratnapala@gmail.com> - 2012-08-25 08:07 -0700
                                Re: dereference Vincenzo Mercuri <vincenzo.mercuri@yahoo.it> - 2012-08-25 17:55 +0200
                                  Re: dereference Adrian Ratnapala <adrian.ratnapala@gmail.com> - 2012-08-25 10:58 -0700
                                Re: dereference Ike Naar <ike@iceland.freeshell.org> - 2012-08-25 20:39 +0000
                                  Re: dereference Adrian Ratnapala <adrian.ratnapala@gmail.com> - 2012-08-26 14:49 -0700
                                Re: dereference "Bill Cunningham" <nospam@nspam.invalid> - 2012-08-25 18:36 -0400
                                  Re: dereference Keith Thompson <kst-u@mib.org> - 2012-08-25 16:42 -0700
                                    Re: dereference "Bill Cunningham" <nospam@nspam.invalid> - 2012-08-25 20:19 -0400
                                  Re: dereference Adrian Ratnapala <adrian.ratnapala@gmail.com> - 2012-08-26 14:40 -0700
                                    Re: dereference Adrian Ratnapala <adrian.ratnapala@gmail.com> - 2012-08-26 14:46 -0700
                                      Re: dereference Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-08-27 02:11 -0700
                                      Re: dereference James Kuyper <jameskuyper@verizon.net> - 2012-08-27 08:36 -0400
                                        Re: dereference Adrian Ratnapala <adrian.ratnapala@gmail.com> - 2012-08-27 10:38 -0700
                                          Re: dereference James Kuyper <jameskuyper@verizon.net> - 2012-08-27 13:55 -0400
                                            Re: dereference Adrian Ratnapala <adrian.ratnapala@gmail.com> - 2012-08-27 12:57 -0700
                                              Re: dereference James Kuyper <jameskuyper@verizon.net> - 2012-08-27 16:25 -0400
                                                Re: dereference Kenneth Brody <kenbrody@spamcop.net> - 2012-08-29 10:41 -0400
                                  Re: dereference Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-08-27 02:09 -0700
                              Re: dereference Barry Schwarz <schwarzb@dqel.com> - 2012-08-25 12:16 -0700
                                Re: dereference Keith Thompson <kst-u@mib.org> - 2012-08-25 16:40 -0700
                                  Re: dereference "Bill Cunningham" <nospam@nspam.invalid> - 2012-08-25 21:21 -0400
                                  Re: dereference Barry Schwarz <schwarzb@dqel.com> - 2012-08-25 21:48 -0700
                            Re: dereference Les Cargill <lcargill99@comcast.com> - 2012-08-25 13:08 -0500
                            Re: dereference Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-08-27 02:02 -0700
                        Re: dereference Andrew Cooper <amc96@cam.ac.uk> - 2012-08-25 02:53 +0100
                          Re: dereference Hans Vlems <hvlems@freenet.de> - 2012-08-27 00:10 -0700
                          Re: dereference Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-08-27 02:14 -0700
                            Re: dereference Adrian Ratnapala <adrian.ratnapala@gmail.com> - 2012-08-27 10:34 -0700
                              Re: dereference Kenneth Brody <kenbrody@spamcop.net> - 2012-08-29 10:22 -0400
    Re: dereference Les Cargill <lcargill99@comcast.com> - 2012-08-20 17:38 -0500
      Re: dereference "Bill Cunningham" <nospam@nspam.invalid> - 2012-08-20 18:41 -0400
    Re: dereference "christian.bau" <christian.bau@cbau.wanadoo.co.uk> - 2012-08-20 16:43 -0700
      Re: dereference Mark Bluemel <mark_bluemel@pobox.com> - 2012-08-21 09:22 +0100
      Re: dereference "Bill Cunningham" <nospam@nspam.invalid> - 2012-08-21 16:12 -0400

Page 3 of 4 — ← Prev page 1 2 [3] 4  Next page →


#25040

FromAdrian Ratnapala <adrian.ratnapala@gmail.com>
Date2012-08-26 14:40 -0700
Message-ID<5dd8c606-6a85-4460-9e9d-ee6a43038e14@googlegroups.com>
In reply to#24959
 
> >     int cbc_crypt(char *key, char *data, unsigned datalen, 
> >                   unsigned mode, char *ivec)
> >
> > Notice it is `char *`, not `const char *`.  This is a hint that the 
> [snip]
>     Would the man page author have done us all a big favor and instead of  
> calling all the char *'s in this example char key[] for example? Or is this 
> just me and something I didn't get at first.

Good question, but the answer is: NO!  The author got it right.

For example you could do:

    char *key = malloc(length_of_the_goddamn_key);
    
    cbc_crypt(key, ...);
    .
    .
    free(key);

Here, `key` points to writeable memory, but is in no sense an array.  In fact it's a pointer right down to it's very soul.

[toc] | [prev] | [next] | [standalone]


#25042

FromAdrian Ratnapala <adrian.ratnapala@gmail.com>
Date2012-08-26 14:46 -0700
Message-ID<111e175a-1a08-439a-8491-82e6b725e028@googlegroups.com>
In reply to#25040
On Sunday, 26 August 2012 23:40:13 UTC+2, Adrian Ratnapala  wrote:
> > >     int cbc_crypt(char *key, char *data, unsigned datalen, 
> > >                   unsigned mode, char *ivec)
>
> >     Would the man page author have done us all a big favor and instead of  
> > calling all the char *'s in this example char key[] for example? Or is
[snip]
> Good question, but the answer is: NO!  The author got it right.

I should add, that although this all look like a big subtlety, it isn't.  The thing in the man page was probably created by just cut-and-pasting whatever was in the header file.  And that's a good thing -- it gives the language-lawyers a canonical source to work with.

And here in this thread, we are language-lawyers.  I don't even know if there would be any pracitcal difference had the function prototype said `char key[]`; the only reason I care is that an unusually sharp newbie is asking pointed questions. 

[toc] | [prev] | [next] | [standalone]


#25085

FromNick Keighley <nick_keighley_nospam@hotmail.com>
Date2012-08-27 02:11 -0700
Message-ID<e9945b6d-188f-4098-ac0a-fdb7fadc929e@e14g2000yqm.googlegroups.com>
In reply to#25042
On Aug 26, 10:46 pm, Adrian Ratnapala <adrian.ratnap...@gmail.com>
wrote:
> On Sunday, 26 August 2012 23:40:13 UTC+2, Adrian Ratnapala  wrote:
> > > >     int cbc_crypt(char *key, char *data, unsigned datalen,
> > > >                   unsigned mode, char *ivec)
>
> > >     Would the man page author have done us all a big favor and instead of
> > > calling all the char *'s in this example char key[] for example? Or is
> [snip]
> > Good question, but the answer is: NO!  The author got it right.
>
> I should add, that although this all look like a big subtlety, it isn't.  The thing in the man page was probably created by just cut-and-pasting whatever was in the header file.  And that's a good thing -- it gives the language-lawyers a canonical source to work with.
>
> And here in this thread, we are language-lawyers.  I don't even know if there would be any pracitcal difference had the function prototype said `char key[]`;

no, none.

> the only reason I care is that an unusually sharp newbie is asking pointed questions.

Bill? newbie? sharp newbie?!

:-)

[toc] | [prev] | [next] | [standalone]


#25096

FromJames Kuyper <jameskuyper@verizon.net>
Date2012-08-27 08:36 -0400
Message-ID<k1fpl4$h3e$1@dont-email.me>
In reply to#25042
On 08/26/2012 05:46 PM, Adrian Ratnapala wrote:
...
> ... the only reason I care is that an unusually sharp newbie is asking pointed questions.

Bill is not a newbie. He's very carefully (some would say suspiciously)
maintained exactly his current nearly-complete lack of understanding of
C despite having asked frequently asked questions about it for more than
a decade, and having received large quantities of helpful answers to
those questions. The only way he could be considered sharp is if he's
faking his ignorance, which is in fact what many people think he's
doing. I'd like to apply Hanlon's Razor to him, but it's been a long
time since I felt comfortable doing so.
-- 
James Kuyper

[toc] | [prev] | [next] | [standalone]


#25115

FromAdrian Ratnapala <adrian.ratnapala@gmail.com>
Date2012-08-27 10:38 -0700
Message-ID<519c3667-3b9d-4139-8fbf-12cbfcfd1495@googlegroups.com>
In reply to#25096
> Bill is not a newbie. He's very carefully (some would say suspiciously) 
> maintained exactly his current nearly-complete lack of understanding of

Well I have only been hear about a week, so I am the newbie.


> C despite having asked frequently asked questions about it for more than
> a decade, and having received large quantities of helpful answers to
> those questions. The only way he could be considered sharp is if he's
> faking his ignorance, which is in fact what many people think he's

Well, I am starting to share this suspicion; I think his questions are genuinely sharp; which makes him look like some kind of white-hat troll trying to increase the educational value of this list.

> doing. I'd like to apply Hanlon's Razor to him, but it's been a long
> time since I felt comfortable doing so.

Well I suppose the "white-hat" thing might excuse him from "malice".

[toc] | [prev] | [next] | [standalone]


#25117

FromJames Kuyper <jameskuyper@verizon.net>
Date2012-08-27 13:55 -0400
Message-ID<503BB47F.2080505@verizon.net>
In reply to#25115
On 08/27/2012 01:38 PM, Adrian Ratnapala wrote:
> 
>> Bill is not a newbie. He's very carefully (some would say suspiciously) 
>> maintained exactly his current nearly-complete lack of understanding of
> 
> Well I have only been hear about a week, so I am the newbie.
> 
> 
>> C despite having asked frequently asked questions about it for more than
>> a decade, and having received large quantities of helpful answers to
>> those questions. The only way he could be considered sharp is if he's
>> faking his ignorance, which is in fact what many people think he's
> 
> Well, I am starting to share this suspicion; I think his questions are genuinely sharp; which makes him look like some kind of white-hat troll trying to increase the educational value of this list.
> 
>> doing. I'd like to apply Hanlon's Razor to him, but it's been a long
>> time since I felt comfortable doing so.
> 
> Well I suppose the "white-hat" thing might excuse him from "malice".

I've seen nothing to suggest he deserves a "white-hat" designation. His
questions generally reflect a great deal of confusion about the C
language, without being worded in such a way as to shed light on those
points of confusion. The malicious interpretation of his actions is
based upon the assumption that he enjoys seeing people waste their time
trying to explain things to him. He responds with comments saying that
he finally understands, but in those very same messages he says things
making it clear that he does not (except possibly in the negative sense
that he does understand, and deliberately writes his response to suggest
that he does not).

In the past, he's claimed to have a medical condition that requires him
to take drugs which have the side-effect of making it impossible for him
to learn anything. This is the only non-malicious interpretation I've
ever seen for his actions that makes any sense. In that case, it's a
waste of his time to try to learn anything as complicated as C, and it's
a waste of everyone else's time to try to teach it to him. However, by
the same token he's also incapable of learning that it's a waste of his
time (to be fair, some of the people who've been trying to help him seem
equally incapable of learning it). It all holds together logically, but
I've been finding it increasingly difficult to believe.

[toc] | [prev] | [next] | [standalone]


#25129

FromAdrian Ratnapala <adrian.ratnapala@gmail.com>
Date2012-08-27 12:57 -0700
Message-ID<5192c7e6-965a-428a-9227-03e321faef40@googlegroups.com>
In reply to#25117
> waste of his time to try to learn anything as complicated as C, and it's

C is not complicated.

 

[toc] | [prev] | [next] | [standalone]


#25133

FromJames Kuyper <jameskuyper@verizon.net>
Date2012-08-27 16:25 -0400
Message-ID<503BD7BA.9030804@verizon.net>
In reply to#25129
On 08/27/2012 03:57 PM, Adrian Ratnapala wrote:
>> waste of his time to try to learn anything as complicated as C, and it's
> 
> C is not complicated.

It's more complicated than, for instance, tic-tac-toe, which seems to be
about the most complicated thing I can think of that he could reasonably
be expected to understand, based upon past experience. I'm not saying
he's capable of developing any meaningful strategy while playing the
game, but I do think he's capable of remembering the rules long enough
to play at least one game, possibly several. I would not recommend
assuming that he'll still remember the rules the next day, though he's
likely to claim that he does.

I'm sorry to be so nasty about this, but he's either suffering under a
extremely cruel learning disability, or he's a moderately clever troll.
In the first case my "nasty" description is entirely accurate; in the
second it accurately describes the false front he's been projecting -
either way, I stand by it.

[toc] | [prev] | [next] | [standalone]


#25389

FromKenneth Brody <kenbrody@spamcop.net>
Date2012-08-29 10:41 -0400
Message-ID<ppadnURFmam_t6PNnZ2dnUVZ_qOdnZ2d@bestweb.net>
In reply to#25133
On 8/27/2012 4:25 PM, James Kuyper wrote:
> On 08/27/2012 03:57 PM, Adrian Ratnapala wrote:
>>> waste of his time to try to learn anything as complicated as C, and it's
>>
>> C is not complicated.

It's complicated enough.  It's not as if he had said "as spicy as oatmeal".  :-)

> It's more complicated than, for instance, tic-tac-toe, which seems to be
> about the most complicated thing I can think of that he could reasonably
> be expected to understand, based upon past experience. I'm not saying
> he's capable of developing any meaningful strategy while playing the
> game, but I do think he's capable of remembering the rules long enough
> to play at least one game, possibly several. I would not recommend
> assuming that he'll still remember the rules the next day, though he's
> likely to claim that he does.

"I forget.  Who goes first?  'Z' or 'W'?"

> I'm sorry to be so nasty about this, but he's either suffering under a
> extremely cruel learning disability, or he's a moderately clever troll.
> In the first case my "nasty" description is entirely accurate; in the
> second it accurately describes the false front he's been projecting -
> either way, I stand by it.

I still haven't made up my mind about him (Bill Cunningham), and if I have 
some spare time, I sometimes respond to his posts.  At least, in his case, I 
have no emotional involvement in the discussion.

Unlike a couple of posters to a mailing list I frequent, related to the 
software I help maintain.  I understand that, to a lawyer (the "worst 
offender" on said list is a lawyer), giving the shortest answer is often a 
good strategy.  However, when asking for help, and someone asks you for 
details on what's going on, and asks several direct, specific questions, 
it's not in your best interest to give an extremely terse answer to the 
first question and ignore the rest.  (Several members of the list have asked 
me, off-list, why I even bother.  Note that the list is not an "official" 
means of communication, and it's run by a third party.)

-- 
Kenneth Brody

[toc] | [prev] | [next] | [standalone]


#25084

FromNick Keighley <nick_keighley_nospam@hotmail.com>
Date2012-08-27 02:09 -0700
Message-ID<e85bb96c-db3e-4afc-8347-518785a69298@s15g2000yqo.googlegroups.com>
In reply to#24959
On Aug 25, 11:36 pm, "Bill Cunningham" <nos...@nspam.invalid> wrote:
> Adrian Ratnapala wrote:
> > On Saturday, 25 August 2012 15:46:50 UTC+2, Bill Cunningham  wrote:
> > [regarding "array" is not a pointer"]
> >>     This is something I know because its been drilled into me. But
> >> the thing is I haven't yet caught onto the real meaning yet. For
> >> example I know of a funtion whose prototype is char * but if you put
> >> a string into it the function doesn't work correctly it's called
> >> cbc_crypt(). You have to pass char key[]="string"; to char *key, the
> >> first parameter. Not quite sure why yet but that's the way it works.
>
> > That's a really nice example; (warning) I didn't know about
> > cbc_crypt()
> > until just now, but I will try to explain it anyway.  My man page
> > says:
>
> >     int cbc_crypt(char *key, char *data, unsigned datalen,
> >                   unsigned mode, char *ivec);
>
> > Notice it is `char *`, not `const char *`.  This is a hint that the
> > function will be read, and *write* into the buffer.  So one way or
> > another, `key` must point to writeable memory.
>
> [snip]
>
>     Would the man page author have done us all a big favor and instead of
> calling all the char *'s in this example char key[] for example? Or is this
> just me and something I didn't get at first.

presumably the author assumed his audience were C programmers

[toc] | [prev] | [next] | [standalone]


#24935

FromBarry Schwarz <schwarzb@dqel.com>
Date2012-08-25 12:16 -0700
Message-ID<819i38tcrf2he55808b75m6g0gquoj528m@4ax.com>
In reply to#24910
On Sat, 25 Aug 2012 09:46:50 -0400, "Bill Cunningham"
<nospam@nspam.invalid> wrote:

>Barry Schwarz wrote:
>
>> There are no pointer variables in your code.  Go back and start again
>> from scratch while writing "Arrays and pointers are different objects"
>> 1000 times.
>
>    This is something I know because its been drilled into me. But the thing 
>is I haven't yet caught onto the real meaning yet. For example I know of a 

If you don't understand the meaning, how can you possibly claim to
know something?  If you really knew arrays and pointers were
different, you would never attempt to assign a value to an array name
as you did in this code from your 24 Aug message:

>>char p[]="hello world\n";
>>p==NULL;

>funtion whose prototype is char * but if you put a string into it the 
>function doesn't work correctly it's called cbc_crypt(). You have to pass 
>char key[]="string"; to char *key, the first parameter. Not quite sure why 
>yet but that's the way it works.

If you insist on taking big bytes without chewing your food, you
really shouldn't be surprised when you choke on something.  Stop
playing with functions you don't understand until after you master the
basics.

-- 
Remove del for email

[toc] | [prev] | [next] | [standalone]


#24962

FromKeith Thompson <kst-u@mib.org>
Date2012-08-25 16:40 -0700
Message-ID<lnk3wmfsma.fsf@nuthaus.mib.org>
In reply to#24935
Barry Schwarz <schwarzb@dqel.com> writes:
> On Sat, 25 Aug 2012 09:46:50 -0400, "Bill Cunningham"
> <nospam@nspam.invalid> wrote:
>>Barry Schwarz wrote:
>>> There are no pointer variables in your code.  Go back and start again
>>> from scratch while writing "Arrays and pointers are different objects"
>>> 1000 times.
>>
>>    This is something I know because its been drilled into me. But the thing 
>>is I haven't yet caught onto the real meaning yet. For example I know of a 
>
> If you don't understand the meaning, how can you possibly claim to
> know something?  If you really knew arrays and pointers were
> different, you would never attempt to assign a value to an array name
> as you did in this code from your 24 Aug message:
>
>>>char p[]="hello world\n";
>>>p==NULL;

That's not an assignment, it's a comparison.  The statement

    p==NULL;

is perfectly legal, though it's utterly useless.

(I don't know whether it was *meant* to be an assignment.)

-- 
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"

[toc] | [prev] | [next] | [standalone]


#24972

From"Bill Cunningham" <nospam@nspam.invalid>
Date2012-08-25 21:21 -0400
Message-ID<k1btmf$6t2$1@speranza.aioe.org>
In reply to#24962
Keith Thompson wrote:

> (I don't know whether it was *meant* to be an assignment.)

Yes.

[toc] | [prev] | [next] | [standalone]


#24977

FromBarry Schwarz <schwarzb@dqel.com>
Date2012-08-25 21:48 -0700
Message-ID<fhaj3852b2mt4fju1goc7d74amk6uv37ga@4ax.com>
In reply to#24962
On Sat, 25 Aug 2012 16:40:13 -0700, Keith Thompson <kst-u@mib.org>
wrote:

>Barry Schwarz <schwarzb@dqel.com> writes:
>> On Sat, 25 Aug 2012 09:46:50 -0400, "Bill Cunningham"
>> <nospam@nspam.invalid> wrote:
>>>Barry Schwarz wrote:
>>>> There are no pointer variables in your code.  Go back and start again
>>>> from scratch while writing "Arrays and pointers are different objects"
>>>> 1000 times.
>>>
>>>    This is something I know because its been drilled into me. But the thing 
>>>is I haven't yet caught onto the real meaning yet. For example I know of a 
>>
>> If you don't understand the meaning, how can you possibly claim to
>> know something?  If you really knew arrays and pointers were
>> different, you would never attempt to assign a value to an array name
>> as you did in this code from your 24 Aug message:
>>
>>>>char p[]="hello world\n";
>>>>p==NULL;
>
>That's not an assignment, it's a comparison.  The statement
>
>    p==NULL;
>
>is perfectly legal, though it's utterly useless.

Absolutely true on both counts.  Another reason why those of us with
bad eyes beg for judicial horizontal white space.

>
>(I don't know whether it was *meant* to be an assignment.)

Since Bill responded yes, I claim clairvoyance and responded to his
intent if not his text.

-- 
Remove del for email

[toc] | [prev] | [next] | [standalone]


#24926

FromLes Cargill <lcargill99@comcast.com>
Date2012-08-25 13:08 -0500
Message-ID<k1b42a$s1v$1@dont-email.me>
In reply to#24885
Barry Schwarz wrote:
> On Fri, 24 Aug 2012 19:36:12 -0400, "Bill Cunningham"
> <nospam@nspam.invalid> wrote:
>
>> Kenneth Brody wrote:
>>> Using GC, if I remove the note from the left drawer, what happens to
>>> the money in the right drawer?
>>
>> That sounds like a null pointer.
>> char p[]="hello world\n";
>> p==NULL;
>>
>
> There are no pointer variables in your code.  Go back and start again
> from scratch while writing "Arrays and pointers are different objects"
> 1000 times.
>

Would the terms "l-value" and "r-value" be of any use here?

--
Les Cargill

[toc] | [prev] | [next] | [standalone]


#25083

FromNick Keighley <nick_keighley_nospam@hotmail.com>
Date2012-08-27 02:02 -0700
Message-ID<ee0b3ac6-1621-4de2-82c0-9c1adad284f5@q20g2000vbx.googlegroups.com>
In reply to#24885
On Aug 25, 5:44 am, Barry Schwarz <schwa...@dqel.com> wrote:
> On Fri, 24 Aug 2012 19:36:12 -0400, "Bill Cunningham"
>
> <nos...@nspam.invalid> wrote:
> >Kenneth Brody wrote:
> >> Using GC, if I remove the note from the left drawer, what happens to
> >> the money in the right drawer?
>
> >That sounds like a null pointer.
> >char p[]="hello world\n";
> >p==NULL;

what?

> There are no pointer variables in your code.  Go back and start again
> from scratch while writing "Arrays and pointers are different objects"
> 1000 times.
>
> --
> Remove del for email

[toc] | [prev] | [next] | [standalone]


#24880

FromAndrew Cooper <amc96@cam.ac.uk>
Date2012-08-25 02:53 +0100
Message-ID<beWZr.22675$mc1.9051@fx12.am4>
In reply to#24862
On 24/08/2012 18:31, Kenneth Brody wrote:
> On 8/24/2012 6:00 AM, Hans Vlems wrote:
>> On 23 aug, 03:26, "Bill Cunningham" <nos...@nspam.invalid> wrote:
>>> Keith Thompson wrote:
>>>> No, it isn't the same thing at all, and the difference is *exactly*
>>>> what we've been discussing.
>>>
>>> Ok I read Kenneth Brody's post. I guess the difference is the pointer
>>> and
>>> what it's pointing at.
>>
>> Imagine two drawers in a cabinet. The right drawer contains a one
>> dollar note. The left drawer contains a note that says "one dollar
>> note in right drawer".
>> The content of the left drawer points to the right drawer. Only the
>> right drawer holds the real thing (the money).
> 
> Using GC, if I remove the note from the left drawer, what happens to the
> money in the right drawer?
> 

Depends.

Is there another draw (the centre one perhaps) with a note saying "one
dollar in the right drawer"?

If yes, then nothing
If no, then the dollar turns into free space.

~Andrew

[toc] | [prev] | [next] | [standalone]


#25072

FromHans Vlems <hvlems@freenet.de>
Date2012-08-27 00:10 -0700
Message-ID<73d2b454-8e1f-4216-bf26-683069df932b@d7g2000vbv.googlegroups.com>
In reply to#24880
On 25 aug, 03:53, Andrew Cooper <am...@cam.ac.uk> wrote:
> On 24/08/2012 18:31, Kenneth Brody wrote:
>
>
>
>
>
> > On 8/24/2012 6:00 AM, Hans Vlems wrote:
> >> On 23 aug, 03:26, "Bill Cunningham" <nos...@nspam.invalid> wrote:
> >>> Keith Thompson wrote:
> >>>> No, it isn't the same thing at all, and the difference is *exactly*
> >>>> what we've been discussing.
>
> >>> Ok I read Kenneth Brody's post. I guess the difference is the pointer
> >>> and
> >>> what it's pointing at.
>
> >> Imagine two drawers in a cabinet. The right drawer contains a one
> >> dollar note. The left drawer contains a note that says "one dollar
> >> note in right drawer".
> >> The content of the left drawer points to the right drawer. Only the
> >> right drawer holds the real thing (the money).
>
> > Using GC, if I remove the note from the left drawer, what happens to the
> > money in the right drawer?
>
> Depends.
>
> Is there another draw (the centre one perhaps) with a note saying "one
> dollar in the right drawer"?
>
> If yes, then nothing
> If no, then the dollar turns into free space.
>
> ~Andrew- Tekst uit oorspronkelijk bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -

No, the dollar remains inside its own (right) drawer. It is not
affected by the operation.

[toc] | [prev] | [next] | [standalone]


#25086

FromNick Keighley <nick_keighley_nospam@hotmail.com>
Date2012-08-27 02:14 -0700
Message-ID<604a1d77-d4aa-41aa-ae8c-ee264b5c0bfe@b10g2000yqc.googlegroups.com>
In reply to#24880
On Aug 25, 2:53 am, Andrew Cooper <am...@cam.ac.uk> wrote:
> On 24/08/2012 18:31, Kenneth Brody wrote:
>
>
>
>
>
>
>
>
>
> > On 8/24/2012 6:00 AM, Hans Vlems wrote:
> >> On 23 aug, 03:26, "Bill Cunningham" <nos...@nspam.invalid> wrote:
> >>> Keith Thompson wrote:
> >>>> No, it isn't the same thing at all, and the difference is *exactly*
> >>>> what we've been discussing.
>
> >>> Ok I read Kenneth Brody's post. I guess the difference is the pointer
> >>> and
> >>> what it's pointing at.
>
> >> Imagine two drawers in a cabinet. The right drawer contains a one
> >> dollar note. The left drawer contains a note that says "one dollar
> >> note in right drawer".
> >> The content of the left drawer points to the right drawer. Only the
> >> right drawer holds the real thing (the money).
>
> > Using GC, if I remove the note from the left drawer, what happens to the
> > money in the right drawer?
>
> Depends.
>
> Is there another draw (the centre one perhaps) with a note saying "one
> dollar in the right drawer"?
>
> If yes, then nothing
> If no, then the dollar turns into free space.

not if you assume drawers are variables. That's the trouble with
strained analogies.

[toc] | [prev] | [next] | [standalone]


#25113

FromAdrian Ratnapala <adrian.ratnapala@gmail.com>
Date2012-08-27 10:34 -0700
Message-ID<84c3be2a-3504-4af7-9430-1f5b073c03ba@googlegroups.com>
In reply to#25086
> not if you assume drawers are variables. That's the trouble with 
> strained analogies.

When I read it, I thought of drawers as patches of memory, each untyped, but of big enough store at least a pointer.  I don't think that's such a strained analogy.

[toc] | [prev] | [next] | [standalone]


Page 3 of 4 — ← Prev page 1 2 [3] 4  Next page →

Back to top | Article view | comp.lang.c


csiph-web