From 3444687590748227181
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,972722ed514d508a
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2001-07-26 14:49:01 PST
Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!212.74.64.35!colt.net!dispose.news.demon.net!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail
From: Francis Glassborow <francis.glassborow@ntlworld.com>
Newsgroups: comp.std.c++
Subject: Re: try block as main block of a function
Date: Thu, 26 Jul 2001 21:48:04 GMT
Organization: Southfield Microcomputer SS
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <cKmyuWA$AJY7EwG1@ntlworld.com>
References: <3b6061b5.1188820@news.terra.es>
Reply-To: Francis Glassborow <francisG@robinton.demon.co.uk>
X-Trace: mail2news.demon.co.uk 996184089 mail2news:28898 mail2news mail2news.demon.co.uk
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
MIME-Version: 1.0
X-Newsreader: Turnpike Integrated Version 5.00 U <TilyaeicE$WmMOP9F8P4$y3lmP>
Lines: 45
Xref: archiver1.google.com comp.std.c++:6755

In article <3b6061b5.1188820@news.terra.es>, J. Daniel Garcia Sanchez
<jdaniel.garcia@terra.es> writes
>Could anybody tell me if this is legal ?
>
>void f()
>try {
>  do_something();
>} 
>catch (...) {
>  handle_my_errors();
>}
>
>Or should I write?
>
>void f()
>{
>  try {
>    do_something();
>  } 
>  catch (...) {
>    handle_my_errors();
>  }
>}
>
>I've seen the former in a book, but my compiler (MSVC++ 6.0) only
>accepts the latter.

Well they are actually different things, and I would not advocate the
version that wraps an entire function in a try block (it fell out of the
grammar change to allow wrapping a ctor-init list in a try block, which
is sometimes necessary. I am not surprised that an old compiler like
VC++6 doesn't understand it (and I would not blame MS for that).


Francis Glassborow      ACCU
64 Southfield Rd
Oxford OX4 1PA          +44(0)1865 246490
All opinions are mine and do not represent those of any organisation

---
[ 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                ]



