Arrarys of reference

From: Tim Clacy (nospamtcl_at_nospamphaseone.nospamdk)
Date: 10/31/03


Date: Fri, 31 Oct 2003 15:57:49 +0100

I know arrays of references are not allowed, but have a couple of questions:

1) Why aren't arrays of references allowed :-) ?

2) What's a good practical alternative?

As an example, Intel's PXA255 processor's DMA controller has 16 consecutive
registers for DMA channel control & status called DCSRx. It would be nice to
have a short-hand access to these registers in addition to indirect access
through structure members:

// Simple hardware model
//
struct DMAController
{
    Register DCSR[16];
    Register DINT;
    :
} dmac;

// Short-hand aliases
//
Register& DCSR0 = dmac.DCSR[0];
Register& DCSR1 = dmac.DCSR[1];
Register& DCSR2 = dmac.DCSR[2];
Register& DCSR3 = dmac.DCSR[3];
:

// This would be handy, but isn't allowed... and how would the references be
initialised in any case?
//
Register& DCSR[16];

If arrays of references were allowed, registers could be accessed using
DCSR[n]. Does anyone have a solution that would allow such convenient
short-hand? This is largely academic, since access through a structure
members will get the job done; however, I would be interested in any
thoughts and/or solutions (it bugs me). In general, if there is an array of
objects, how can access be provided to those objects by reference still
using array operators?

Tim



Relevant Pages

  • Re: Arrarys of reference
    ... to initialize the references correctly. ... Maybe because arrays of references often couldn't be ... | Register DCSR; ...
    (comp.lang.cpp)
  • Re: Excel References
    ... closing the References dialog, then reopen the References dialog and recheck ... Click OK and the VBE will register the DLL and add ... (MISSING is present) ...
    (microsoft.public.excel.programming)
  • Re: Excel References
    ... registers the DLL properly on the user's machine then there shouldn't be any ... I re-establish the References, XL runs fine. ... "Joe" wrote in message ... Click OK and the VBE will register the DLL ...
    (microsoft.public.excel.programming)
  • Re: Cant delete an assembly from the GAC!
    ... > How does one register that a certain assembly depends on another? ... >> applications have registered their references to this GACed assembly ... the SysInternals ProcessExplorer tool that Peter mentioned ... it may also be that the DLL file is simply ...
    (microsoft.public.dotnet.framework)
  • Re: Returning a struct from a function - strange behavior
    ... values to store the return value in a register; ... just plain impossible for most structs that contain arrays. ... the standard should stay at a very high level ...
    (comp.lang.c)