comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <jrcarter@acm.org>
Subject: Re: Question: Combination of Access and Constraining
Date: Fri, 21 Feb 2003 01:21:04 GMT
Date: 2003-02-21T01:21:04+00:00	[thread overview]
Message-ID: <3E557F4C.1010101@acm.org> (raw)
In-Reply-To: 3E553C5E.7B2850FD@tsoft.com

Yuri wrote:
> And how efficient will be eventual comparison/argument
> passing code resulting from such Null_Tp constant? Is it going to be
> one-instruction comparison in ASM or much more?

The answer is, a software engineer doesn't care. Until it is done in the 
most straightforward, readable, and understandable way, and measurement 
shows that the system does not meet its timing requirments, and analysis 
shows that the only way to meet those timing requirements is by dealing 
with these issues, it's not an issue. Since compilers are very good at 
dealing with these kinds of things, I doubt it will ever be an issue. 
Those who worry about such things with no evidence that they are 
problems are simply wasting the most expensive resource on the project.

Since the actual parameter for one of these arguments may be of any 
length between zero and Positive'Last, they are almost certainly passed 
by reference, so I don't see that it gains you anything in the parameter 
passing department over explicitly passing a reference.

As for comparison, I guess it depends on what you're doing. An explicit 
check would look something like

if Arg8347'Length = 0 then
    -- zero-length handling
else
    -- non-zero-length handling
end if;

If, as is likely, you simply ignore the null parameters, then it will 
probably look like

for I in Arg9387'range loop
    -- non-zero-length handling
end loop;

and the loop is not entered if the parameter is null. This should be 
more "efficient" than

if Arg9387 /= null then
    for I in Arg9387'range loop
       ...
    end loop;
end if;

> For access argument and null it probably will be just on-liner
> comparison and one liner passing argument.

Since access parameters often have accessability information and 
associated checks associated with them this may not be correct.

-- 
Jeff Carter
"English bed-wetting types."
Monty Python & the Holy Grail




  reply	other threads:[~2003-02-21  1:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-20  8:06 Question: Combination of Access and Constraining Papandopulo
2003-02-20  9:00 ` tmoran
2003-02-20  9:29 ` Dmitry A. Kazakov
2003-02-20 15:20   ` Papandopulo
2003-02-20 16:20     ` Dmitry A. Kazakov
2003-02-20 17:58     ` Jeffrey Carter
2003-02-20 20:35       ` Yuri
2003-02-21  1:21         ` Jeffrey Carter [this message]
2003-02-21 22:53           ` Yuri
2003-02-23 12:34             ` Simon Wright
2003-02-23 17:50               ` Jeffrey Carter
2003-02-23 17:55               ` John R. Strohm
2003-02-23 17:48             ` John R. Strohm
2003-02-20 13:12 ` David C. Hoos, Sr.
2003-02-20 15:00 ` Matthew Heaney
  -- strict thread matches above, loose matches on Subject: below --
2003-02-20  9:46 Grein, Christoph
replies disabled

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