comp.lang.ada
 help / color / mirror / Atom feed
* Re: Unconstrained arrays
@ 1993-08-12 15:00 Robert Dewar
  0 siblings, 0 replies; 49+ messages in thread
From: Robert Dewar @ 1993-08-12 15:00 UTC (permalink / raw)


Wayne did not put it quite right. It is not that the compiler "cannot figure
it out", since of course in many cases (and in this case in particular) it
certainly could figure out what you meant IF it was legal Ada, but it is not
legal Ada. As is clear in the RM, Ada deliberately outlaws these one element
aggregates, partly because they seem confusing at a programmer level, and
partly because there are (more obscure) situations in which allowing the
resulting additional overloading cases would be tricky. Consider for example:

	"abc" & ('d')

Is the right operand a one element string, resulting in the use of the 
string&string concatenation, or is it a character with redundant parentheses
resulting in the use of the string&character concatenation.

Of course the result would be the same, but you can't have this kind of
semantic ambiguity hanging around (suppose both versions of concatenation
had been redefined to do something completely different from the standard
version, and different from one another).

So often in language design you run across a simple case which you think
should be easy to handle, but then more complex cases come and bite you.
You can take the approach of distinguishing between the cases but this
definitely adds complexity (have a look for example at Algol-68, which
resolved such ambiguities by distinguishing the "strength" of a position,
[roughly the extent to which the required type is known a priori]. There
were several different strengths (including weak, firm and strong), and
the rules of what expressions were valid depended on the strength.

In particular, the rowing coercion in Algol-68, which converts a single
element to a one dimensional array with one element (just what we are talking
about here), applies in a strong position (the original example given would
correspond to a strong position, where you know what type you wanted), but
not in a firm position (the operands of a binary operator are firm positions).

Very nice, problem solved! But many folks found these coercion rules in
Algol-68 tricky, so in practice the Ada approach: "since we can't have it
everywhere, let's not allow it anywhere" seems the right one in this particular
case, although you can't generalize this phiolosophy always, sometimes you
prefer a special exception (e.g. the one in Ada that allows you to omit
the type of array bounds if it is INTEGER, on the other hand, I know people
who DON'T like that particular special case).

  "A designer's lot is not a happy one" 

      (adapted from W.S. Gilbert: Norman, care to fill in the rest of the
      (adapted from W.S. Gilbert: Norman, care to fill in the rest of the

	words for this :-)

^ permalink raw reply	[flat|nested] 49+ messages in thread
* Unconstrained Arrays
@ 2009-03-17  0:59 belteshazzar
  2009-03-17  1:49 ` Jeffrey R. Carter
  2009-03-17 20:14 ` anon
  0 siblings, 2 replies; 49+ messages in thread
From: belteshazzar @ 2009-03-17  0:59 UTC (permalink / raw)


I have a program that uses a lot of different sized arrays and passed
into math functions. So I'm using an unconstrained array type. The
problem that I have is that I'm not allowed to use "new" this means
that I have to use pools (which I can't because to intantiate a pool I
have to constrain the array type) or allocated the arrays on the
stack. Allocating the arrays on the stack is fine, BUT it means that i
have to use array initializers so that they remain unconstrained
rather than becoming an anonomous contrained type that can no longer
be passed to my math functions.

We have now noticed that because of the size of our arrays that the
array intialisation is causing significant performance issues. Thus,
we need a new way of handling our arrays.

The best option seems to be to turn the functions that take arrays
into generic functions and instantiate them on the fly according to
the required size. Does anyone know if there are performance issues
with dynamically creating instantiations of generic functions all over
teh place?

Also, and the main point of my post, I've found that I can place the
unconstrained array inside a record with a distriminant and this seems
to solve all our problems. We don't have to use array initialisers and
we can get pointers to aliased objects that can be easily passed to
the math functions.

Has anyone come across these sorts of issues? I'm curious as to the
solution that others have found, and why Ada seems to handle
unconstrained arrays differently to unconstrained arrays inside a
record.



^ permalink raw reply	[flat|nested] 49+ messages in thread
* Unconstrained arrays
@ 2001-12-11 17:17 Michael Unverzagt
  2001-12-11 18:22 ` Stephen Leake
  2001-12-11 18:24 ` Mark Lundquist
  0 siblings, 2 replies; 49+ messages in thread
From: Michael Unverzagt @ 2001-12-11 17:17 UTC (permalink / raw)


Hi!

We have to write a programm that uses an unconstrained array of
ustrings, where the size of the array should be determined by user
input...

How does this work? Someone told me, I have to use subtypes but...
Does anyone know a simple example where I can learn how I can define the
size of an array at runtime by user input?

thx
  Mike



^ permalink raw reply	[flat|nested] 49+ messages in thread
* Re: Unconstrained arrays
@ 1993-08-15  5:01 Alex Blakemore
  0 siblings, 0 replies; 49+ messages in thread
From: Alex Blakemore @ 1993-08-15  5:01 UTC (permalink / raw)


In article <9308111642.aa06180@Paris.ics.uci.edu> kanderso@mabillon.ICS.UCI.EDU
 (Kenneth Anderson) writes:
> >>   Viewers : str_array(1 .. 1) := (Create("text_artist"));
> >>--### A:error: RM 8.3: no visible identifier is of type str_array

I dont know about your compiler error, but if what you are trying
to do is to create a ragged array of strings AND the array is essentially const
ant,
I've found it much easier in Ada to define a string valued function than an arr
ay.

function viewers (index : positive) return string is
begin
  case index is
    when 1 => return "text_artist";
    when 2 => return "another string";
  ...

the calling code refers only to viewers (i).  this way you dont
have to do the dynamic allocation yourself, and a smart compiler might
put it all on the stack or on a data or even text segment.
you dont have to have a dynamic string type or use .all on each reference.

of course, this doesnt work as simply if you plan to be able to modify 
the mapping at run time.


-- 
Alex Blakemore       alex@cs.umd.edu        NeXT mail accepted
--------------------------------------------------------------
"Without an engaged and motivated human being at the keyboard,
the computer is just another dumb box."      William Raspberry

^ permalink raw reply	[flat|nested] 49+ messages in thread
* Re: Unconstrained arrays
@ 1993-08-13 21:08 J. Craig Heberle
  0 siblings, 0 replies; 49+ messages in thread
From: J. Craig Heberle @ 1993-08-13 21:08 UTC (permalink / raw)


In article <9308111528.aa04642@Paris.ics.uci.edu>, kanderso@mabillon.ICS.UCI.ED
U (Kenneth Anderson) writes:
|> Hello,
|> 
|>   I have declared the following type (DynamicString is an imported type)
|> 
|>         type Str_Array is array (Natural range <>) of DynamicString;
|> 
|> Later when I try to declare objects of this type, the compiler likes this
|> 
|> 
|>    Viewers : str_array(1 .. 6) := (Create("Airspeed_Guage"),
|>                                    Create("Altimeter_Guage"),
|>                                    Create("Compass_Guage"),
|>                                    Create("Horizon_Guage"),
|>                                    Create("ROC_Guage"),
|>                                    Create("Turn_Guage"));
|> 
|> but it does not like this
|> 
|>    Viewers : str_array(1 .. 1) := (Create("text_artist"));
|> 
|> Here is the error message generated by the SunAda 1.1 compiler
|> 
|> 
|> --### A:error: RM 8.3: no visible identifier is of type str_array
|> 
|> 
|> If I change the above declaration to
|> 
|>    Viewers : str_array(1 .. 2) := (Create("text_artist"),
|>                                    Create("ignore"));
|> 
|> The compiler is happy again.
|> 
|>   Can someone help me out on this?  Why can't I declare AND initialize
|> an array of only one element?
|> 
|> Any help would be appreciated,
|> 
|> Thanks in advance,
|> 
|> Ken Anderson

LRM page 4-7, section 4.3.4:  "Aggregates containing a single
component association must always be given in named notation."

  Viewers : str_array (1 .. 1) := (1 => Create("text_artist"));

This will compile.
-- 
===================================================================
                              |    EMAIL address:
Craig Heberle                 |    heberle@pat.mdc.com
                              |    
===================================================================

^ permalink raw reply	[flat|nested] 49+ messages in thread
* Re: Unconstrained arrays
@ 1993-08-13 12:34 Paul Durbin
  0 siblings, 0 replies; 49+ messages in thread
From: Paul Durbin @ 1993-08-13 12:34 UTC (permalink / raw)


kanderso@mabillon.ICS.UCI.EDU (Kenneth Anderson) writes:

>Hello,

>  I have declared the following type (DynamicString is an imported type)

>        type Str_Array is array (Natural range <>) of DynamicString;

>Later when I try to declare objects of this type, the compiler likes this


>   Viewers : str_array(1 .. 6) := (Create("Airspeed_Guage"),
>                                   Create("Altimeter_Guage"),
>                                   Create("Compass_Guage"),
>                                   Create("Horizon_Guage"),
>                                   Create("ROC_Guage"),
>                                   Create("Turn_Guage"));

>but it does not like this

>   Viewers : str_array(1 .. 1) := (Create("text_artist"));

>Here is the error message generated by the SunAda 1.1 compiler


>--### A:error: RM 8.3: no visible identifier is of type str_array


>If I change the above declaration to

>   Viewers : str_array(1 .. 2) := (Create("text_artist"),
>                                   Create("ignore"));

>The compiler is happy again.

>  Can someone help me out on this?  Why can't I declare AND initialize
>an array of only one element?

>Any help would be appreciated,

>Thanks in advance,

>Ken Anderson

See LRM 4.3(4).
  "Aggregates containing a single component association must always be given
   in named notation."

ywbm,
paul durbin

^ permalink raw reply	[flat|nested] 49+ messages in thread
* Re: Unconstrained arrays
@ 1993-08-12 21:23 Robert Dewar
  0 siblings, 0 replies; 49+ messages in thread
From: Robert Dewar @ 1993-08-12 21:23 UTC (permalink / raw)


Jim Crigler suggests:                                   

       Viewers : str_array (1 .. 1) := str_array'(Creat("text_artist"));

No, no, no! The qualification is useful only to determine the type wanted,but
we know what type we want (str_array!) The trouble is that the expression
(Creat("Text_artists")) just isn't of that type, as I hope the previous
answers have made clear.

I would strongly suggest that people make a habit of testing out replies
to queries of this kind by doing trial compilations with a reasonable Ada
compiler. I certainly do (and I am supposed to know Ada!) I think this would
result in fewer correcter responses to technical queries.

In this case, I ran it on an Alsys version 5 compiler and got:

.       8  Viewers2 : src_array (1 .. 1) := src_array'(Create("text_artist"));
.                                                      <--------1--------->
.1   **IDE There is a type inconsistency in this expression.
.
.
.
.        =================================================== More Information =
=
.        -> The context requires the following type(s):
.            - MAIN.SRC_ARRAY at line  3, an array type of STANDARD.INTEGER
.        -> But the expression has the following type(s) :
.            - STANDARD.INTEGER
.        ======================================================================
=



A rather lengthy, but absolutely accurate, error message!
I also ran it under GNAT, and got:

     8.  Viewers2 : src_array (1 .. 1) := src_array'(Create("text_artist"));

						     |
							   
                                                     |
        error: expect type "src_array" in this context


which isn't quite so verbose as the Alsys message, but is also accurate.
Actually we generally operate in brief, Unix-compatible error message mode,
which gives:

"t.ada", line 8: error: expect type "src_array" in this context

We usually find that the error flags aren't needed, and in any case we have
added a column positioning feature to EMACS so that the error message handling
in EMACS will position the cursor to the point of the error flag.

^ permalink raw reply	[flat|nested] 49+ messages in thread
* Re: Unconstrained arrays
@ 1993-08-12 19:25 Wes Groleau x1240 C73-8
  0 siblings, 0 replies; 49+ messages in thread
From: Wes Groleau x1240 C73-8 @ 1993-08-12 19:25 UTC (permalink / raw)


In article <9308111528.aa04642@Paris.ics.uci.edu> kanderso@mabillon.ICS.UCI.EDU
 (Kenneth Anderson) writes:
>   Viewers : str_array(1 .. 1) := (Create("text_artist"));
>--### A:error: RM 8.3: no visible identifier is of type str_array

Part of the problem is that Verdix (the "ghostwriter" of SunAda) apparently
hired non-English speakers to write their English error messages.  MANY of
their message do not state what the problem actually is.  Others are on the
right track, but taken literally say exactly the oposite of what they meant.

The other part is one of Ada 83's imperfections  (if you're Ted Holden, that's
another word for federal disaster area).

The fix is:
   Viewers : str_array(1 .. 1) := ( 1 => Create("text_artist") );

BTW, Create looks like something in one of those packages I complained about
in my other post, and so does the name DynamicString.  Are you stuck with that
package?  If not, are you in a hurry?  I could give you my package, but it 
would take me a while to transfer it from a closed system to the Internet.

Wes G.

^ permalink raw reply	[flat|nested] 49+ messages in thread
* Re: Unconstrained arrays
@ 1993-08-12 17:27 agate!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.ed
  0 siblings, 0 replies; 49+ messages in thread
From: agate!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.ed @ 1993-08-12 17:27 UTC (permalink / raw)


Ray Blaak (blaak@csri.toronto.edu) wrote:

: Viewers : srt_array(1..1) := ( 1 => Create("text_artist"));

Or how about this: 

	Viewers : str_array (1 .. 1) := str_array'(Creat("text_artist"));

Jim Crigler
-------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 49+ messages in thread
* Re: Unconstrained arrays
@ 1993-08-12 16:26 Mark A Biggar
  0 siblings, 0 replies; 49+ messages in thread
From: Mark A Biggar @ 1993-08-12 16:26 UTC (permalink / raw)


In article <9308111528.aa04642@Paris.ics.uci.edu> kanderso@mabillon.ICS.UCI.EDU
 (Kenneth Anderson) writes:
>  I have declared the following type (DynamicString is an imported type)
>        type Str_Array is array (Natural range <>) of DynamicString;
>Later when I try to declare objects of this type, the compiler likes this
>   Viewers : str_array(1 .. 6) := (Create("Airspeed_Guage"),
>                                   Create("Altimeter_Guage"),
>                                   Create("Compass_Guage"),
>                                   Create("Horizon_Guage"),
>                                   Create("ROC_Guage"),
>                                   Create("Turn_Guage"));
>but it does not like this
>   Viewers : str_array(1 .. 1) := (Create("text_artist"));
>Here is the error message generated by the SunAda 1.1 compiler
>--### A:error: RM 8.3: no visible identifier is of type str_array
>If I change the above declaration to
>   Viewers : str_array(1 .. 2) := (Create("text_artist"),
>                                   Create("ignore"));
>The compiler is happy again.

I think that one of your problems is that the error message is very
missleading.  You real problem is that you can't use positional notation
for single element aggregates.  The compiler can't tell the difference
between a single element positional aggregate and a simple expression with an
extra set of enclosing parens.  So convert your aggregate to named notation
like so:

    Viewers : str_array(1..1) := (1 => Create("text_artist"));

and that should fix your problem.
And, if you really want to make sure that the complier excepts and also
document what is really going on, use a qualified expression for the
initializer like so:

   Viewers : str_array(1..1) := str_array'(1 => Create("text_artist"));

--
Mark Biggar
mab@wdl.loral.com

^ permalink raw reply	[flat|nested] 49+ messages in thread
* Re: Unconstrained arrays
@ 1993-08-12 16:00 Dave Collar d x7468
  0 siblings, 0 replies; 49+ messages in thread
From: Dave Collar d x7468 @ 1993-08-12 16:00 UTC (permalink / raw)


In <9308111528.aa04642@Paris.ics.uci.edu> kanderso@mabillon.ICS.UCI.EDU (Kennet
h Anderson) writes:

>Hello,

>  I have declared the following type (DynamicString is an imported type)

>        type Str_Array is array (Natural range <>) of DynamicString;

>Later when I try to declare objects of this type, the compiler likes this


>   Viewers : str_array(1 .. 6) := (Create("Airspeed_Guage"),
>                                   Create("Altimeter_Guage"),
>                                   Create("Compass_Guage"),
>                                   Create("Horizon_Guage"),
>                                   Create("ROC_Guage"),
>                                   Create("Turn_Guage"));

>but it does not like this

>   Viewers : str_array(1 .. 1) := (Create("text_artist"));

>Here is the error message generated by the SunAda 1.1 compiler


>--### A:error: RM 8.3: no visible identifier is of type str_array


>If I change the above declaration to

>   Viewers : str_array(1 .. 2) := (Create("text_artist"),
>                                   Create("ignore"));

>The compiler is happy again.

>  Can someone help me out on this?  Why can't I declare AND initialize
>an array of only one element?

You can.  the problem is that
  "Aggregates containing a single component association must always be
   given in named notation"  LRM 4.3(4)

  So change your declaration to either
 
    Viewers : str_array(1..1) := (1 => Create("text_artist")); 
    
        or
  
    Viewers : str_array(1..1) := (others => Create("text_artist")); 

  This rule is required so that the compiler can tell that it is an
  aggregate.  The compiler is not allowed to use any information from
  within the aggregate to determine the type of aggregate.  "An
  aggregate can always be distinguished from an expression enclosed by 
  parenthesis: this is a consequence of the fact that named notation is
  required for an aggregate with a single component"  LRM 4.3(8)

--Thor
dlc@ddsdx2.jhuapl.edu 

^ permalink raw reply	[flat|nested] 49+ messages in thread
* Re: Unconstrained arrays
@ 1993-08-12 15:28 Robert I. Eachus
  0 siblings, 0 replies; 49+ messages in thread
From: Robert I. Eachus @ 1993-08-12 15:28 UTC (permalink / raw)


In article <9308111528.aa04642@Paris.ics.uci.edu> kanderso@mabillon.ICS.UCI.EDU
 (Kenneth Anderson) writes:

   > I have declared the following type (DynamicString is an imported type)
   >     type Str_Array is array (Natural range <>) of DynamicString;
   > Later when I try to declare objects of this type, the compiler
   > likes this...but it does not like this
   >     Viewers : str_array(1 .. 1) := (Create("text_artist"));

   >   Can someone help me out on this?  Why can't I declare AND initialize
   > an array of only one element?

   You can, but a single value in parentheses is treated as a
parenthesized expression not an aggregate (see 4.3(4)).  Try using
named notation:

   Viewers : str_array(1 .. 1) := (1 => Create("text_artist"));


--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...

^ permalink raw reply	[flat|nested] 49+ messages in thread
* Re: Unconstrained arrays
@ 1993-08-12 13:03 Raymond Blaak
  0 siblings, 0 replies; 49+ messages in thread
From: Raymond Blaak @ 1993-08-12 13:03 UTC (permalink / raw)


kanderso@mabillon.ICS.UCI.EDU (Kenneth Anderson) writes:

>>>
>>>   Viewers : str_array(1 .. 1) := (Create("text_artist"));
>>>
>>>--### A:error: RM 8.3: no visible identifier is of type str_array
>>>

This is an error because (Create("text_artist")) is an element not an array.

>> What about:
>>    Viewers : srt_array(1) := (Create("text_artist"));

This is an error because srt_array(1) is indexing notation, not array
declaration notation.

The trick is to force the compiler into thinking that Viewers is being
assigned an array. Try this:

Viewers : srt_array(1..1) := ( others => Create("text_artist"));

or if you prefer, this:

Viewers : srt_array(1..1) := ( 1 => Create("text_artist"));

Cheers,
Ray
blaak@csri.toronto.edu

^ permalink raw reply	[flat|nested] 49+ messages in thread
* Re: Unconstrained arrays
@ 1993-08-12 12:14 cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!howland.
  0 siblings, 0 replies; 49+ messages in thread
From: cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!howland. @ 1993-08-12 12:14 UTC (permalink / raw)


Kenneth Anderson (kanderso@mabillon.ICS.UCI.EDU) wrote:

:    Viewers : str_array(1 .. 1) := (Create("text_artist"));

The problem is that the "("...")" can either be an expression
(like (1+2)) or a slice.  The compiler cannot figure out which
use of the parens to use.  To give the compiler some help
use the following:

    Viewers : str_array(1 .. 1) := (1=>Create("text_artist"));

It will then determine that you have a one element slice, not
an expression of type DynamicString.

Wayne Donaho.

^ permalink raw reply	[flat|nested] 49+ messages in thread
* Re: Unconstrained arrays
@ 1993-08-12 12:03 cis.ohio-state.edu!pacific.mps.ohio-state.edu!math.ohio-state.edu!magnus.
  0 siblings, 0 replies; 49+ messages in thread
From: cis.ohio-state.edu!pacific.mps.ohio-state.edu!math.ohio-state.edu!magnus. @ 1993-08-12 12:03 UTC (permalink / raw)


In article aa06180@Paris.ics.uci.edu, kanderso@mabillon.ICS.UCI.EDU (Kenneth An
derson) writes:
>In comp.lang.ada you write:
>
>>In article <9308111528.aa04642@Paris.ics.uci.edu>, kanderso@mabillon.ICS.UCI.
EDU (Kenneth Anderson) writes...
>
>>>
>>>   Viewers : str_array(1 .. 1) := (Create("text_artist"));
>>>
>>>--### A:error: RM 8.3: no visible identifier is of type str_array
>>>
>> What about:
>
>>    Viewers : srt_array(1) := (Create("text_artist"));
>
>> (just a hunch)
>
>Thanks for the reply.
>
>The compiler didn't like this either, it said...
>
>   Viewers : str_array(1) := (Create("text_artist"));
>-----------------------^A                                                    #
##
>------------------------------^B                                             #
##
>--### A:error: RM (many references): range expected
>--### B:error: RM 8.3: no visible identifier is of type str_array
>
>So I know (now) that I need a range for sure...
>
>Thanks again,
>
>Ken

I think that I have seen something similar.  If I remember right the
following worked (although I don't think it was Sun Ada).

   Viewers : str_array(1..1) := (1 => Create("text_artist"));

If this should work, I have no idea why?  Let me know.

                           Bob

^ permalink raw reply	[flat|nested] 49+ messages in thread
* Re: Unconstrained arrays
@ 1993-08-11 23:42 Kenneth Anderson
  0 siblings, 0 replies; 49+ messages in thread
From: Kenneth Anderson @ 1993-08-11 23:42 UTC (permalink / raw)


In comp.lang.ada you write:

>In article <9308111528.aa04642@Paris.ics.uci.edu>, kanderso@mabillon.ICS.UCI.E
DU (Kenneth Anderson) writes...

>>
>>   Viewers : str_array(1 .. 1) := (Create("text_artist"));
>>
>>--### A:error: RM 8.3: no visible identifier is of type str_array
>>
> What about:

>    Viewers : srt_array(1) := (Create("text_artist"));

> (just a hunch)

Thanks for the reply.

The compiler didn't like this either, it said...

   Viewers : str_array(1) := (Create("text_artist"));
-----------------------^A                                                    ##
#
------------------------------^B                                             ##
#
--### A:error: RM (many references): range expected
--### B:error: RM 8.3: no visible identifier is of type str_array

So I know (now) that I need a range for sure...

Thanks again,

Ken

^ permalink raw reply	[flat|nested] 49+ messages in thread
* Re: Unconstrained arrays
@ 1993-08-11 23:40 cis.ohio-state.edu!math.ohio-state.edu!cs.utexas.edu!swrinde!menudo.uh.ed
  0 siblings, 0 replies; 49+ messages in thread
From: cis.ohio-state.edu!math.ohio-state.edu!cs.utexas.edu!swrinde!menudo.uh.ed @ 1993-08-11 23:40 UTC (permalink / raw)


In article <9308111528.aa04642@Paris.ics.uci.edu>, kanderso@mabillon.ICS.UCI.ED
U (Kenneth Anderson) writes...

> 
>   Viewers : str_array(1 .. 1) := (Create("text_artist"));
> 
>--### A:error: RM 8.3: no visible identifier is of type str_array
> 
 What about:

    Viewers : srt_array(1) := (Create("text_artist"));

 (just a hunch)

^ permalink raw reply	[flat|nested] 49+ messages in thread
* Unconstrained arrays
@ 1993-08-11 22:29 Kenneth Anderson
  0 siblings, 0 replies; 49+ messages in thread
From: Kenneth Anderson @ 1993-08-11 22:29 UTC (permalink / raw)


Hello,

  I have declared the following type (DynamicString is an imported type)

        type Str_Array is array (Natural range <>) of DynamicString;

Later when I try to declare objects of this type, the compiler likes this


   Viewers : str_array(1 .. 6) := (Create("Airspeed_Guage"),
                                   Create("Altimeter_Guage"),
                                   Create("Compass_Guage"),
                                   Create("Horizon_Guage"),
                                   Create("ROC_Guage"),
                                   Create("Turn_Guage"));

but it does not like this

   Viewers : str_array(1 .. 1) := (Create("text_artist"));

Here is the error message generated by the SunAda 1.1 compiler


--### A:error: RM 8.3: no visible identifier is of type str_array


If I change the above declaration to

   Viewers : str_array(1 .. 2) := (Create("text_artist"),
                                   Create("ignore"));

The compiler is happy again.

  Can someone help me out on this?  Why can't I declare AND initialize
an array of only one element?

Any help would be appreciated,

Thanks in advance,

Ken Anderson

^ permalink raw reply	[flat|nested] 49+ messages in thread

end of thread, other threads:[~2009-03-29 16:24 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-08-12 15:00 Unconstrained arrays Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
2009-03-17  0:59 Unconstrained Arrays belteshazzar
2009-03-17  1:49 ` Jeffrey R. Carter
2009-03-17  2:58   ` belteshazzar
2009-03-17  4:15     ` Jeffrey Creem
2009-03-17  5:20     ` Jeffrey R. Carter
2009-03-17 17:56       ` Jeffrey R. Carter
2009-03-17 23:10         ` belteshazzar
2009-03-18 18:31           ` Jeffrey R. Carter
2009-03-20  1:53           ` Peter C. Chapin
2009-03-20  6:45             ` sjw
2009-03-20  9:46               ` Jacob Sparre Andersen
2009-03-20 11:40               ` Jean-Pierre Rosen
2009-03-25 21:11                 ` sjw
2009-03-25 22:30                   ` Robert A Duff
2009-03-25 23:28                     ` Randy Brukardt
2009-03-26  0:03                       ` Jeffrey R. Carter
2009-03-26  1:00                         ` Robert A Duff
2009-03-20 12:15               ` christoph.grein
2009-03-20 15:45               ` Adam Beneschan
2009-03-23  8:26                 ` belteshazzar
2009-03-25 21:21                 ` sjw
2009-03-25 22:03                   ` Adam Beneschan
2009-03-26  1:32                     ` tmoran
2009-03-27  8:39                   ` Jean-Pierre Rosen
2009-03-27 20:07                     ` sjw
2009-03-29 16:24                     ` sjw
2009-03-27 11:57                   ` Gautier
2009-03-17 15:33     ` Adam Beneschan
2009-03-17 23:00       ` belteshazzar
2009-03-17 20:14 ` anon
2001-12-11 17:17 Unconstrained arrays Michael Unverzagt
2001-12-11 18:22 ` Stephen Leake
2001-12-11 18:24 ` Mark Lundquist
1993-08-15  5:01 Alex Blakemore
1993-08-13 21:08 J. Craig Heberle
1993-08-13 12:34 Paul Durbin
1993-08-12 21:23 Robert Dewar
1993-08-12 19:25 Wes Groleau x1240 C73-8
1993-08-12 17:27 agate!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.ed
1993-08-12 16:26 Mark A Biggar
1993-08-12 16:00 Dave Collar d x7468
1993-08-12 15:28 Robert I. Eachus
1993-08-12 13:03 Raymond Blaak
1993-08-12 12:14 cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!howland.
1993-08-12 12:03 cis.ohio-state.edu!pacific.mps.ohio-state.edu!math.ohio-state.edu!magnus.
1993-08-11 23:42 Kenneth Anderson
1993-08-11 23:40 cis.ohio-state.edu!math.ohio-state.edu!cs.utexas.edu!swrinde!menudo.uh.ed
1993-08-11 22:29 Kenneth Anderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox