comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Krischik <martin@krischik.com>
Subject: Re: expect procedure name in procedure call(newbie)
Date: Wed, 29 Dec 2004 19:46:49 +0100
Date: 2004-12-29T19:46:49+01:00	[thread overview]
Message-ID: <55225700.btkFaDockb@linux1.krischik.com> (raw)
In-Reply-To: 1104316623.493536.111460@f14g2000cwb.googlegroups.com

R wrote:

> Hello.
> 
> I've got 'expect procedure name in procedure call' warning but
> I think my code is good
> Inside testclass.adb I have Create function and when I'm trying to call
> it from
> main.adb unit I receive that error.
> 
> Below are full codes of my Ada units.
> 
> And by the way - how can I dynamically allocate memory for e.g. 10
> elements(array of Floats)?
> How can I reallocate them to 20 elements or 4?
> How can I free the memory?

If you learn for Hobby then I  suggest a container lib with support for
indefinite object:

http://en.wikibooks.org/wiki/Programming:Ada:Libraries:MultiPurpose:AdaCL#Components.

If not you have to do it the hard way:

http://en.wikibooks.org/wiki/Programming:Ada:Types:access

> thanks in advance
> best regards R
> 
> Codes:
> 
> main.adb:
> --------
> with testclass;
> procedure Main is
> object : testclass.rec1_Access;
> begin
> testclass.Create(object, 10);
> end Main;
> 
> testclass.ads:
> --------------
> package testclass is
> type rec1 is tagged private;
> type rec1_Access is access rec1;
> function Create(this: rec1_Access; s: Integer) return Integer;

You call the parameter this - but Create is a "static" method. Read:

http://en.wikibooks.org/wiki/Programming:Ada:OO#Primitive_operations

> private
> type rec1 is tagged record
> field: Integer;
> end record;
> end testclass;
> 
> testclass.adb:
> --------------
> package body testclass is
> function Create(this: rec1_Access; s: Integer) return Integer is
> begin
> this.field :=s;

your are aware that this is null?

> return this.field;
> end Create;
> end testclass;

-- 
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com



      parent reply	other threads:[~2004-12-29 18:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-29 10:37 expect procedure name in procedure call(newbie) R
2004-12-29 12:07 ` Florian Weimer
2004-12-29 13:03   ` R
2004-12-29 13:24     ` Mark Lorenzen
2004-12-29 12:32 ` Martin Dowie
2004-12-29 12:34   ` Martin Dowie
2004-12-29 18:46 ` Martin Krischik [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