home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.vhdl
- Path: sparky!uunet!spool.mu.edu!agate!usenet.ins.cwru.edu!gatech!hubcap!ncrcae!ncrcol.ColumbiaSC.NCR.COM!beihl
- From: beihl@ncrcol.ColumbiaSC.NCR.COM (Gary Beihl)
- Subject: Overload Resolution (Was: type conversion and configuration)
- Message-ID: <1993Jan05.101254.26831@ncrcae.ColumbiaSC.NCR.COM>
- Nntp-Posting-Host: linville.columbiasc.ncr.com
- Organization: NCR E&M Columbia SC.
- References: <1992Dec30.130712.5464@phcomgw.seri.philips.nl> <1993Jan4.225957.26359@viewlogic.com>
- Date: Tue, 05 Jan 93 15:12:54 GMT
- Lines: 39
-
- In article <1993Jan4.225957.26359@viewlogic.com> sunder@viewlogic.com (Sunder Singhani) writes:
- >
- >The above IS ambiguous. Explanation follows -
-
- IMHO, there is NO ambiguity. Sufficient information is available.
-
- >-- 4 FUNCTION To_X01 ( b : BIT_VECTOR ) RETURN std_logic_vector;
- >-- 5 FUNCTION To_X01 ( b : BIT_VECTOR ) RETURN std_ulogic_vector;
- >
- >Of these you are choosing 4, 5 explicitly by using type qualification -
- >ie bit_vector'("00"). 5 returns std_logic_vector and 4 returns std_ulogic_vector.
-
- So far, so good. Yes, there are two candidates with the same parameter and
- result profile.
-
- >The first one when indexed gives you an element of std_ulogic, and the latter
- >gives std_logic. Now, std_logic is a subtype of std_ulogic, which implies
- >both have the same base type which is std_ulogic. Hence, you end up
- >with two interpretations, which is erroneous. The final type qualification
-
- Not so fast. Just because the parameter/result profiles match doesn't mean
- the declaration is ambiguous. According to LRM 10.5 (The Context of Overload
- Resolution) there is a list of rules to be considered along with syntax and
- scope/visiblity rules. The first of these is:
-
- "1. Any rule that requires a name or expression to have a certain type,
- or to have the same type as another name or expression."
-
- Since this is a constant declaration with a default expression, the following
- rule for interface objects (LRM 4.3.3) seems applicable:
-
- "...The type of a default expression must be that of the corresponding
- interface object."
-
- This narrows the search down to a single choice. Unless I've missed
- something, Model Technologies appears to be doing the right thing here.
-
- Gary Beihl (gary.beihl@columbiasc.ncr.com)
-
-