From 418256232701377982 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f78e5,74637d148a591f02 X-Google-Attributes: gidf78e5,public X-Google-ArrivalTime: 2001-03-27 15:15:32 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!news.iac.net!news-out.cwix.com!newsfeed.cwix.com!news.alt.net!comp-std-cpp-robomod!not-for-mail From: James Dennett Newsgroups: comp.std.c++ Subject: Re: Proposal: two real uses for the "auto" keyword Date: Tue, 27 Mar 2001 17:08:44 CST Organization: Altopia Corp. - Usenet Access - http://www.altopia.com Lines: 53 Approved: Fergus Henderson , moderator of comp.std.c++ Message-ID: <3AC1098A.7C16EDAF@acm.org> References: <052201c0b4ab$603e8050$0500a8c0@dragonsys.com> <99l3nf$7n0$1@news-int.gatech.edu> <+zJqQ9Afowv6Ews1@ntlworld.com> <3ABF4E68.14646D4E@acm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-Path: 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) Resent-From: fjh@cs.mu.OZ.AU Resent-Message-Id: <200103272300.JAA13708@hg.cs.mu.oz.au> X-NNTP-Posting-Host: jamesd.demon.co.uk:194.222.230.41 X-Trace: news.demon.co.uk 985729418 nnrp-13:20149 NO-IDENT jamesd.demon.co.uk:194.222.230.41 X-Complaints-To: abuse@demon.net X-Accept-Language: en Resent-Date: Wed, 28 Mar 2001 09:00:54 +1000 Resent-To: fjh+csc-submit@cs.mu.OZ.AU Xref: supernews.google.com comp.std.c++:4040 Risto Lankinen wrote: > > Hi! > > James Dennett wrote in message > news:3ABF4E68.14646D4E@acm.org... > > Francis Glassborow wrote: > > > > > > In article <99l3nf$7n0$1@news-int.gatech.edu>, Brian McNamara! > > > writes > > > >(As an aside, I am curious why function declarations are even allowed > > > >inside functions.) > > > > > > Almost certainly for compatibility with C. > > > > Would it be sensible to consider deprecating this feature, > > or removing it altogether? It seems to give no significant > > benefit, and plenty of pain. > > The "benefit" is the ability to do overloaded function > selection in a local scope, by utilizing the name hiding > phenomenon. I'm glad you wrote "benefit" in quotation marks. I'd love to get rid of such ugly code at the same time as fixing a real problem. > For example, the program... > > void f(int); > void f(bool); > > void main() > { > void f(bool); > > f(1); > f(false); > } > > ... changes its behaviour when the declaration inside > the main()'s function block is removed. int main, blah blah blah. -- James Dennett --- [ 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 ]