From: defaria@hpclapd.HP.COM (Andy DeFaria)
Subject: Re: C Strings in Ada?
Date: 11 Jun 90 22:39:00 GMT [thread overview]
Message-ID: <920026@hpclapd.HP.COM> (raw)
In-Reply-To: 920024@hpclapd.HP.COM
One of my concerns about coverting Ada Strings to C Strings was the amount
of overhead involved in allocating heap space. Dave Emery stated that the
compiler should not allocated any heap space for a local variable - it
should be placed in the stack:
declare
C_STRING : constant STRING := STRING_PARAM & ASCII.NUL;
begin
-- call C routine
end;
My understanding is that the compiler would allocate space on the stack for
this variable if the size of STRING_PARAM can be determined at compile time
not at run time. Since STRING_PARAM is being passed into my routines it is
not known, at compile time, how big the STRING_PARAM will be (it could
theoretically (sp?) be INTEGER'LAST bytes long!! Assuming a 32 bit integer
size this could be gigantic and with some architectures stack space is
limited and heap space is more plentifull) so the compiler might determine
that it is better to put this variable on the heap instead. This does not
mean that the compiler is faulty. This also might help facilitate
procedure cleanup.
Also, no one has address my other concern about how to represent these
strings in structures such as:
struct data_record {
char *path;
int path_length;
char *name;
int name_length;
}
next prev parent reply other threads:[~1990-06-11 22:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
1990-06-04 22:45 C Strings in Ada? Andy DeFaria
1990-06-07 17:41 ` stt
1990-06-08 16:00 ` Andy DeFaria
1990-06-10 20:38 ` Alex Blakemore
1990-06-11 12:57 ` Allan Doyle
1990-06-11 14:59 ` David Kassover
1990-06-11 19:48 ` Allan Doyle
1990-06-11 21:01 ` David Kassover
1990-06-11 22:30 ` Mike Murphy
1990-06-13 21:20 ` Edward Falis
1990-06-11 17:53 ` David Emery
1990-06-11 19:59 ` Allan Doyle
1990-06-15 7:53 ` Jeff Bartlett
1990-06-11 22:39 ` Andy DeFaria [this message]
1990-06-12 14:04 ` David Emery
1990-06-12 18:11 ` Mike Murphy
1990-06-13 13:43 ` stt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox