From 6920146996448486389
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,8fdf6b501ff64059
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2002-01-07 07:26:05 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!dispose.news.demon.net!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail
From: "Anthony Williams"<anthwil@nortelnetworks.com>
Newsgroups: comp.std.c++
Subject: Re: Possible DRs
Date: Mon,  7 Jan 2002 15:25:10 GMT
Organization: Nortel
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <a1bqer$8rq$1@bcarh8ab.ca.nortel.com>
References: <dPlZ7.4047$cD4.7483@www.newsranger.com> <3C36019C.32739F68@sensor.com> <QFqZ7.4501$cD4.8752@www.newsranger.com>
X-Trace: mail2news.demon.co.uk 1010417149 mail2news:23952 mail2news mail2news.demon.co.uk
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Authentication-Warning: "Anthony Williams"<anthwil@nortelnetworks.com>
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700
Lines: 70
Xref: archiver1.google.com comp.std.c++:8836

"Michiel Salters" <Michiel.Salters@cmg.nl> wrote in message
news:QFqZ7.4501$cD4.8752@www.newsranger.com...
> In article <3C36019C.32739F68@sensor.com>, Ron Natalie says...
> >
> >Michiel Salters wrote:
> >> 3)
> >> What prohibits int f( volatile void )? What does it mean, if it
> >> doesn't cause a program to be ill-formed?
> >
> >Ill-formed.  8.3.5 permits f(void) as a special case only in that
> >exact form.
>
> Yes, that's indeed the special case. But the reasoning by which
> volatile void is ill-formed was not obvious to me.

8.3.5p2 says "The parameter list (void) is equivalent to the empty parameter
list. Except for this special case, void shall not be a parameter type
(though types derived from void, such as void*, can)."

So f(void) is permitted as the special case, f(int,void) is illegal. Fine.

Is volatile-T a "type derived from T"?

In any case, "The cv-qualified or cv-unqualified versions of a type are
distinct types;" (3.9.3p1), so "volatile void" is not "void", and is not
explicitly affected by this restriction.

8.9.1p9 introduces restrictions on void:

"The void type has an empty set of values. The void type is an incomplete
type that cannot be completed. It is used as the return type for functions
that do not return a value. Any expression can be explicitly converted to
type cv void (5.4). An expression of type void shall be used only as an
expression statement (6.2), as an operand of a comma expression (5.18), as a
second or third operand of ?: (5.16), as the operand of typeid, or as the
expression in a return statement (6.6.3) for a function with the return type
void."

However, is an expression of type cv-void necessarily of type void? If so,
why the distinction in the middle of the paragraph? If not, expressions can
be of type "const void", and can then be treated as normal rvalue
expressions --- except that non-class rvalues cannot have cv-qualified
types, so there isn't a problem (though I would personally like to see that
restriction removed, for consistency).

Indeed, since void is not an object type, function parameters of "volatile
void" (which is incomplete) are OK, as only object type parameters are
required to be complete (5.2.2p4)

8.3.2p1 prevents references to cv-void, but that doesn't affect this issue.

In any case, f(volatile void) can never be called, because you cannot have
an lvalue of type void to copy, and rvalues of type void cannot appear in
function call expressions.

Anthony
--
Anthony Williams
Software Engineer, Nortel Networks Optical Components Ltd
The opinions expressed in this message are not necessarily those of my
employer



---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]



