comp.lang.ada
 help / color / mirror / Atom feed
From: "Grein, Christoph" <christoph.grein@eurocopter.com>
Subject: Re: simple newbie program.
Date: Thu, 28 Nov 2002 08:35:58 +0100 (MET)
Date: 2002-11-28T08:35:58+01:00	[thread overview]
Message-ID: <mailman.1038469382.26935.comp.lang.ada@ada.eu.org> (raw)

> package body stack is
>    stack_size : constant := 100;
>    type stack_size_type is range 0..stack_size;
> 
>    top   : stack_size_type;
>    stack : array (stack_size_type'range) of integer;
                                   ~~~~~~
     stack : array (stack_size_type) of integer;

But the size is not stack_size, it's stack_size+1, because you start at 0.

Overflow and underflow are not handled.

>    package int_io is new text_io.integer_io(integer);

There exists a pre-instantiation of Ada.Text_IO.Integer_IO (Integer):
    Ada.Integer_Text_IO;



             reply	other threads:[~2002-11-28  7:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-28  7:35 Grein, Christoph [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-11-28  7:26 simple newbie program prashna
replies disabled

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