Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Steve Thompson <stevet810@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Array operations in C |
| Date | 2015-04-09 00:35 +0000 |
| Organization | Friends of the Galactic Collective |
| Message-ID | <wUBRfc.fYS.2oqyO@gmail.com> (permalink) |
| References | <08d340bd-1867-458e-96cc-83a885cde72d@googlegroups.com> <mg0oe7$jc6$1@dont-email.me> <mg0spt$7bg$1@dont-email.me> |
On Tue, Apr 07, 2015 at 04:24:34PM +0100, Bartc wrote: > On 07/04/2015 15:10, Bartc wrote: > >On 07/04/2015 14:06, beliavsky@aol.com wrote: > > >>Intel C and C++ now support array operations such as the following: > >> > >>r[0:n] = 0; > >>for( int j = 0; j < ncols; ++j ) > >> r[0:n] += a[rowndx[0:n]+j] * v[colndx[rowndx[0:n]+j]]; > >> > >>What is the chance that such operations become part of standard C and > >>are implemented in gcc? > > > >Small. > > > >But, assuming that r[0:n] means n elements of r starting from r[0], > >these map very easily to a normal loop: > > > > r[0:n] = 0; > > > >becomes: > > > > for (k=0; k<n; ++k) > > r[k] = 0; > > A general slice such as r[a:len] is slightly trickier: > > for (k=a; k<(a+len); ++k) > r[k] = 0; > > So it starts to have more value (although an apt macro can take care of > that too). But perhaps somewhat more useful is being able to operate on > the entire array: > > r[:] = 0; // or some such syntax > > this is harder to implement conventionally because there needs to be a > way of picking up the length, and for dynamic arrays this is not stored > anywhere it can be grabbed automatically. > > Maybe Intel C (and was that Intel C++ too?) have sorted that, however > then it becomes a far more fundamental change to the language than more > concise syntax. In other words, it's never going to happen! (Maybe in > C++, but there apparently anything goes.) Perhaps. But it seems obvious to me that parallel programming will become the norm rather than the exception and it is reasonable to suggest that languages will naturally adjust to that paradigm as much as they are able. What that portends for C is another matter. OpenMP and such are only half of the (potential) solution. Exploiting parallelism among cooperating nodes is the other half of the equation and that remains difficult. Perhaps a multi-node shared/virtual memory system will emerge that is analogous to today's hardware assisted VM systems, including a largely transparent message-passing architecture. It would be very convenient to address local and foreign threads transparently, but the basic problem of latency would seem to make that fundamentally problematic. Regards, Steve Thompson -- "If I had a nickel for every time some idiot called me about a computer problem that turned out to be user error, I would be able to retire and spend the rest of my days cultivating clues in my backyard hillside garden." -- MysteryDog in 24hoursupport.helpdesk.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Array operations in C beliavsky@aol.com - 2015-04-07 06:06 -0700
Re: Array operations in C Bartc <bc@freeuk.com> - 2015-04-07 15:10 +0100
Re: Array operations in C Bartc <bc@freeuk.com> - 2015-04-07 16:24 +0100
Re: Array operations in C Steve Thompson <stevet810@gmail.com> - 2015-04-09 00:35 +0000
Re: Array operations in C fir <profesor.fir@gmail.com> - 2015-04-08 07:48 -0700
Re: Array operations in C Tim Prince <tprince@computer.org> - 2015-04-07 10:30 -0400
Array operations in C asetofsymbols@gmail.com - 2015-04-07 08:00 -0700
Array operations in C asetofsymbols@gmail.com - 2015-04-07 08:09 -0700
Array operations in C asetofsymbols@gmail.com - 2015-04-07 08:36 -0700
Array operations in C asetofsymbols@gmail.com - 2015-04-07 08:58 -0700
Array operations in C asetofsymbols@gmail.com - 2015-04-08 00:16 -0700
Array operations in C asetofsymbols@gmail.com - 2015-04-08 01:30 -0700
Re: Array operations in C Tim Prince <tprince@computer.org> - 2015-04-08 08:59 -0400
csiph-web