comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pogner.demon.co.uk>
Subject: Re: Need help with code?
Date: 1997/12/15
Date: 1997-12-15T00:00:00+00:00	[thread overview]
Message-ID: <x7vra7es1p3.fsf@pogner.demon.co.uk> (raw)
In-Reply-To: 66m904$naj$1@usenet48.supernews.com


"Eric Sabo" <sabo@hhs.net> writes:

> Can someone tell what am I doing wrong with this code?
> ----------------------- begin ----------------------------------------
> generic
>  type item_type is private;
> procedure push(x : in out item_type);
> procedure push(x : in out item_type) is
>   type item_node;
>   type item_ptr is access item_node;
    type item_node is                        <<<<<<<<<<<
>   record
>  item : item_type;
>         next : item_ptr;
>   end record;

and again, about 6 times altogether. I found these fairly easily while
using gnatchop to split your source up into individual files .. and
then there are some more problems with the code (eg, at the end you're
calling the generic push rather than the instantiated rec_push or
whatever) .. and why have you separated push, pop etc into separate
generic subprograms rather than making them members of one generic
{stack? list? what?} package?

I think you (and we) would find it a lot easier to see what you were
about if you would lay your code out neatly. I don't know what editor
you're using, emacs has a neat auto-indent feature. If you don't have
such an editor, it's often worth closing the structure before putting
in the contents; eg,

(stage 1)
  begin

(stage 2)
  begin
  end;

(stage 3)
  begin
    stuff ..
  end;

-- 
Simon Wright                        Work Email: simon.j.wright@gecm.com
GEC-Marconi Radar & Defence Systems            Voice: +44(0)1705-701778
Command & Information Systems Division           FAX: +44(0)1705-701800




      parent reply	other threads:[~1997-12-15  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-12-10  0:00 Need help with code? Eric Sabo
1997-12-14  0:00 ` Chris Morgan
1997-12-15  0:00 ` Simon Wright [this message]
replies disabled

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