From -2324942570840098687
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,aa804c06bdf2b5a5
X-Google-Attributes: gidf78e5,public
From: Alexandre Oliva <oliva@dcc.unicamp.br>
Subject: Re: || and && with void argument (was: Proposal fix: [i,j] => [i;j])
Date: 1996/12/23
Message-ID: <ord8w5m132.fsf_-_@dcc.unicamp.br>#1/1
X-Deja-AN: 205634132
references: <58c7b4$ohk@toralf.uib.no> 	<32AB24DB.196A@eden.com><58i0gn$isk@mimsy.cs.umd.edu> 	<58oj5k$mm9@mujibur.inmind.com><58qdek$7vs@gap.cco.caltech.edu> 	<58thrt$gq8@mujibur.inmind.com><9612180510.AA29113@dwrsun4> 	<599ncc$ptc@fsui02.fnal.gov> <01bbed44$d93663c0$3474adce@azguard> <rf5u3pho88f.fsf@vx.cit.alcatel.fr>
x-original-date: 20 Dec 1996 18:07:29 -0200
organization: IC - UNICAMP - Campinas, SP, Brazil
x-auth: PGPMoose V1.1 PGP comp.std.c++
mime-version: 1.0 (generated by tm-edit 7.97)
newsgroups: comp.std.c++
originator: austern@isolde.mti.sgi.com


James Kanze writes:

> bradds@concentric.net (Bradd W. Szonye) writes:
> |>  David Sachs <b91926@fsui02.fnal.gov> wrote in article
>     [...]
> |>  > open(FILE, file) || die();  // C++ is not Pascal

>     [...]
> |>  And I do consider this a "superior" notation, in that it emphasizes the
> |>  "normal" course of events. In the same way that exception handling is
> |>  superior notation in that it segregates the exceptional code after the
> |>  normal course of events.

> More generally, in C++, in cases where failure would not be considered
> normal (say, createTempFile), I would just write the function, and let
> exceptions do their job.  (Unless special actions are taken, exceptions
> cause an abnormal program termination.  Which is, IMHO, an excellent
> default, and probably what die() does.)

Then I'd prefer to write:

FILE = open(file) || throw "Cannot open file";

By the way, what is the type of a throw expression?  Is it void?

The Nov'96 DWP says [except.throw]:

2 [...] The type of
  the throw-expression shall not be an incomplete type, or a pointer  or
  reference  to  an  incomplete  type,  other  than  void*, const void*,
  volatile void*, or const volatile void*.

But I guess it's actually referring to the expression just after the
keyword "throw", not to the type of the evaluated throw expression
(which is never available anyway).

If it were defined to be the same type as the throw argument, there
would be a "portable" way to check the order arguments are evaluated:

void foo(int, bool);
void bar() {
  foo(throw 1, throw false);
}

But then what would the type of a throw expression without any
argument be?

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br
Universidade Estadual de Campinas, SP, Brasil
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu 
]



