Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #14545
| From | Mike McCarty <mcmccarty@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: Pointer Problem |
| Date | 2012-02-27 07:25 -0800 |
| Organization | http://groups.google.com |
| Message-ID | <4787762.9.1330356342660.JavaMail.geo-discussion-forums@vbbdh9> (permalink) |
| References | (11 earlier) <ji8bjd$e2m$1@adenine.netfront.net> <30064152.294.1330102204173.JavaMail.geo-discussion-forums@vbpw16> <8929fa0c-39ac-4786-aedc-776574132604@cj6g2000vbb.googlegroups.com> <3478397.2346.1330320657665.JavaMail.geo-discussion-forums@vbae11> <0d09c4e9-704a-4b8a-a1b2-dc36759675b7@hs8g2000vbb.googlegroups.com> |
On Monday, February 27, 2012 8:07:58 AM UTC-6, Paul wrote: > A 1-dim array doesn't need a multiplier. A 2-dim array doesn't need > two multipliers it only needs one. This is not "loss of information" > as you have put it, the information is not there because it's not > required. I'm not talking about multipliers, I'm talking about knowing the bounds of the underlying array. It is lost information and it is required if you want to (robustly) treat the pointer as a reference to an array of objects. How do you sensibly increment a pointer without knowing the range of values the pointer can logically take? > > An example: > > > > > An example: > > > > int a[10]; > > int (&b)[9] = a[1]; > > > > The C++ language dictates that this is illegal syntax, despite the fact that simple analysis shows that it is perfectly reasonable and logically correct. This is the sort of 'context' you've been referring to but this 'context' is exactly what the language does not support. > > No I never brought references into the discussion., References *are* pointers... If you insist: int a[10]; int (*b)[9] = &a[1]; The argument still holds... > > Given only > > > > int* iptr = something(); > > I wish you wouldn't use this default object construction syntax(or > function syntax) when assigning to pointers, because more often than > not this will not return an objects' address. An objects' address is > assigned to a pointer, not an object. I'm not sure why you'd think it was an object constructor call -- it makes more syntactic sense as a simple function call. In any case, it's pseudo-code. The RHS of the assignment is not relevant which is why I did not work very hard at making it realistic. The point being: A _naked_ pointer cannot be (usefully) treated as an array reference. > A pointer doesn't only point to an object or null because it can also > point to objects(plural). It can point to an object allocated as part of an array, yes. Beyond that, you need external information. If you want to be pedantic about it, you could say that all allocations are array allocations just that many of them are arrays of size 1. Does it change what you can do with pointers? Nope. Does it change the meaning of pointers? Nope. > If you agree with Leighs argument , and disagree with Bjarne S, then I > think you have missed the point :) I'm not sure what you think Leigh's argument is at this point. I see nothing that contradicts anything Bjarne has ever said. I still contend you are in violent agreement.
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Pointer Problem bintom <binoythomas1108@gmail.com> - 2012-02-16 06:51 -0800
Re: Pointer Problem Juha Nieminen <nospam@thanks.invalid> - 2012-02-16 15:15 +0000
Re: Pointer Problem 88888 Dihedral <dihedral88888@googlemail.com> - 2012-02-16 07:17 -0800
Re: Pointer Problem Victor Bazarov <v.bazarov@comcast.invalid> - 2012-02-16 11:15 -0500
Re: Pointer Problem scott@slp53.sl.home (Scott Lurndal) - 2012-02-16 17:18 +0000
Re: Pointer Problem Victor Bazarov <v.bazarov@comcast.invalid> - 2012-02-16 13:46 -0500
Re: Pointer Problem Mike McCarty <mcmccarty@gmail.com> - 2012-02-16 12:41 -0800
Re: Pointer Problem scott@slp53.sl.home (Scott Lurndal) - 2012-02-16 20:45 +0000
Re: Pointer Problem Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-02-17 01:44 -0800
Re: Pointer Problem jt@toerring.de (Jens Thoms Toerring) - 2012-02-17 03:14 +0000
Re: Pointer Problem Juha Nieminen <nospam@thanks.invalid> - 2012-02-17 07:23 +0000
Re: Pointer Problem jt@toerring.de (Jens Thoms Toerring) - 2012-02-18 22:39 +0000
Re: Pointer Problem Peter Remmers <p.remmers@expires-2011-04-30.arcornews.de> - 2012-02-20 21:07 +0100
Re: Pointer Problem Paul <pchristor@yahoo.co.uk> - 2012-02-21 18:49 -0800
Re: Pointer Problem Paul <pchristor@yahoo.co.uk> - 2012-02-21 18:49 -0800
Re: Pointer Problem Juha Nieminen <nospam@thanks.invalid> - 2012-02-22 10:15 +0000
Re: Pointer Problem Paul <pchristor@yahoo.co.uk> - 2012-02-22 07:49 -0800
Re: Pointer Problem Leigh Johnston <leigh@i42.co.uk> - 2012-02-22 20:24 +0000
Re: Pointer Problem Juha Nieminen <nospam@thanks.invalid> - 2012-02-23 10:36 +0000
Re: Pointer Problem "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-02-23 18:59 +0000
Re: Pointer Problem Leigh Johnston <leigh@i42.co.uk> - 2012-02-23 19:15 +0000
Re: Pointer Problem "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-02-23 21:08 +0000
Re: Pointer Problem Leigh Johnston <leigh@i42.co.uk> - 2012-02-23 21:17 +0000
Re: Pointer Problem Leigh Johnston <leigh@i42.co.uk> - 2012-02-23 21:29 +0000
Re: Pointer Problem Joshua Maurice <joshuamaurice@gmail.com> - 2012-02-23 17:06 -0800
Re: Pointer Problem Paul <pchristor@yahoo.co.uk> - 2012-02-24 03:42 -0800
Re: Pointer Problem Leigh Johnston <leigh@i42.co.uk> - 2012-02-24 12:33 +0000
Re: Pointer Problem "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-02-24 15:09 +0000
Re: Pointer Problem Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-02-23 20:53 +0000
Re: Pointer Problem Paul <pchristor@yahoo.co.uk> - 2012-02-24 04:11 -0800
Re: Pointer Problem Leigh Johnston <leigh@i42.co.uk> - 2012-02-24 12:36 +0000
Re: Pointer Problem Paul <pchristor@yahoo.co.uk> - 2012-02-24 06:07 -0800
Re: Pointer Problem Leigh Johnston <leigh@i42.co.uk> - 2012-02-24 14:11 +0000
Re: Pointer Problem "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-02-24 15:49 +0000
Re: Pointer Problem Mike McCarty <mcmccarty@gmail.com> - 2012-02-24 08:50 -0800
Re: Pointer Problem "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-02-24 18:47 +0000
Re: Pointer Problem Paul <pchristor@yahoo.co.uk> - 2012-02-24 13:44 -0800
Re: Pointer Problem Paul <pchristor@yahoo.co.uk> - 2012-02-26 12:41 -0800
Re: Pointer Problem Mike McCarty <mcmccarty@gmail.com> - 2012-02-26 21:30 -0800
Re: Pointer Problem Paul <pchristor@yahoo.co.uk> - 2012-02-27 06:07 -0800
Re: Pointer Problem Mike McCarty <mcmccarty@gmail.com> - 2012-02-27 07:25 -0800
Re: Pointer Problem Paul <pchristor@yahoo.co.uk> - 2012-02-27 08:17 -0800
Re: Pointer Problem Mike McCarty <mcmccarty@gmail.com> - 2012-02-27 08:51 -0800
Re: Pointer Problem Ian Collins <ian-news@hotmail.com> - 2012-02-28 07:18 +1300
Re: Pointer Problem Paul <pchristor@yahoo.co.uk> - 2012-02-27 11:32 -0800
Re: Pointer Problem Paul <pchristor@yahoo.co.uk> - 2012-02-27 11:32 -0800
Re: Pointer Problem Leigh Johnston <leigh@i42.co.uk> - 2012-02-27 19:17 +0000
Re: Pointer Problem Paul <pchristor@yahoo.co.uk> - 2012-02-27 11:49 -0800
Re: Pointer Problem Leigh Johnston <leigh@i42.co.uk> - 2012-02-27 20:04 +0000
Re: Pointer Problem Paul <pchristor@yahoo.co.uk> - 2012-02-27 12:55 -0800
Re: Pointer Problem Leigh Johnston <leigh@i42.co.uk> - 2012-02-27 21:15 +0000
Re: Pointer Problem Paul <pchristor@yahoo.co.uk> - 2012-02-27 14:26 -0800
Re: Pointer Problem Paul <pchristor@yahoo.co.uk> - 2012-02-27 11:21 -0800
Re: Pointer Problem SG <s.gesemann@gmail.com> - 2012-02-16 07:00 -0800
Re: Pointer Problem LR <lruss@superlink.net> - 2012-02-16 16:49 -0500
Re: Pointer Problem Juha Nieminen <nospam@thanks.invalid> - 2012-02-16 22:18 +0000
Re: Pointer Problem LR <lruss@superlink.net> - 2012-02-16 23:40 -0500
Re: Pointer Problem Juha Nieminen <nospam@thanks.invalid> - 2012-02-17 07:24 +0000
Re: Pointer Problem LR <lruss@superlink.net> - 2012-02-17 09:48 -0500
Re: Pointer Problem Juha Nieminen <nospam@thanks.invalid> - 2012-02-17 15:13 +0000
csiph-web