From: Caffeine Junky <nospam@hotmail.com>
Subject: Conditional types?
Date: Sun, 10 Nov 2002 20:34:35 GMT
Date: 2002-11-10T20:34:35+00:00 [thread overview]
Message-ID: <vpzz9.623$7p.887@sccrnsc04> (raw)
I've been trying to figure out if theres a way in Ada(or any other
language for that matter) to test if data is of a certain type without
going into low level bit fiddling and Assembler instructions.
i.e. Hypothetical situation...
You're recieving data through a function call or a procedure of some
sort, but the source for some reason does not indicate explicitly what
type of data it is. However, since you do have some limited knowledge of
the system you can safely assume it's passing either a float, an integer,
or an unsigned 32 bit integer. Is there a way do this in Ada ...
procedure get(bar : in undefined) -- Note that this does not return or
-- output any data
if datatype(bar) is unsigned_32 then
declare
foo : Unsigned_32 := bar;
begin
-- process data here
end;
else if datatype(bar) is Integer then
declare
foo : Integer := bar;
begin
-- process data here
end;
else if datatype(bar) is float then
declare
foo : float := bar;
begin
-- process data here
end;
end if;
end get;
Any tips?
Caffiene Junky
next reply other threads:[~2002-11-10 20:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-10 20:34 Caffeine Junky [this message]
2002-11-10 21:35 ` Conditional types? tmoran
2002-11-11 4:43 ` Caffeine Junky
-- strict thread matches above, loose matches on Subject: below --
2002-11-10 20:34 Caffeine Junky
2002-11-10 23:04 ` Dennis Lee Bieber
2002-11-13 6:41 ` AG
2002-11-11 13:30 ` Marin David Condic
2002-11-11 17:30 ` Larry Kilgallen
2002-11-12 12:50 ` Marin David Condic
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox