Article View: comp.std.c
Article #4477Re: Is a compiler diagnostic required?
From: Tanmoy Bhattacharya
Date: Thu, 14 Dec 1995 21:06
Date: Thu, 14 Dec 1995 21:06
47 lines
2107 bytes
2107 bytes
In article <4apkr7$8sp@rdsunx.crd.ge.com>, volpe@bart.crd.ge.com (Christopher
R. Volpe) writes:
|> In article <4apgml$98i@newshost.lanl.gov>, tanmoy@qcd.lanl.gov (Tanmoy
Bhattacharya) writes:
|> |>Is a compiler required to diagnose the mismatch of parameter types:
|> |>
|> |>void f(va_list*);
|> |>void g(int x,...) {
|> |> va_list y;
|> |> va_start (y,x);
|> |> f(y);
|> |> va_end(y);
|> |>}
|> |>
|> |>Or can the implementation allow it without warning?
|> |>
|> |>(Consider va_list == void* for example of why an implementation may want
to
|> |>do it).
|> |>
|>
|> Why would you want an implementation to allow you to pass a void* to a
|> function declared to take a void**?
Because with a prototype in scope, void* automatically gets _converted_ to
the right type: an explicit cast is not required.
A compiler usually has no way of knowing what a void* is. For example, adding
a
void* z = &y;
and calling f(z) is perfectly conformant program. The compiler may not be
smart enough to know the difference between f(z) and f(y) ... and hence I
believe a diagnostic is not required.
Is it desirable to allow va_list to be a (void*) was the actual question.
Cheers
Tanmoy
--
tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
<http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
Technical Details
Message-ID:
<4aq3l4$g39@newshost.lanl.gov>Path:
arc1-ca.pugleaf.net!qcd.lanl.gov!tanmoyReferences:
<4apgml$98i@newshost.lanl.gov> <4apkr7$8sp@rdsunx.crd.ge.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!qcd.lanl.gov!tanmoy From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya) Newsgroups: comp.std.c Subject: Re: Is a compiler diagnostic required? Date: 14 Dec 1995 21:06:44 GMT Organization: Los Alamos National Laboratory Distribution: world Message-ID: <4aq3l4$g39@newshost.lanl.gov> References: <4apgml$98i@newshost.lanl.gov> <4apkr7$8sp@rdsunx.crd.ge.com> NNTP-Posting-Host: qcd.lanl.gov