From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5969 invoked by alias); 11 Apr 2012 20:48:26 -0000 Received: (qmail 5960 invoked by uid 22791); 11 Apr 2012 20:48:24 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from adamg.eu (HELO adamg.eu) (91.192.224.99) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 Apr 2012 20:48:06 +0000 Received: from mail.agmk.net ([91.192.224.71]:43310 ident=postfix) by adamg.eu with esmtp (Exim 4.77) (envelope-from ) id 1SI4SP-0001Av-AG; Wed, 11 Apr 2012 22:48:01 +0200 Received: from localhost.localnet (unknown [89.78.237.144]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: pluto@agmk.net) by mail.agmk.net (Postfix) with ESMTPSA id D41802128030; Wed, 11 Apr 2012 22:48:00 +0200 (CEST) From: =?utf-8?B?UGF3ZcWC?= Sikora To: gcc@gcc.gnu.org Cc: Richard Guenther , Lawrence Crowl , Jakub Jelinek , Xinliang David Li , Bernd Schmidt , Gabriel Dos Reis , David Edelsohn , Diego Novillo Subject: Re: Switching to C++ by default in 4.8 Date: Wed, 11 Apr 2012 20:48:00 -0000 Message-ID: <2263533.VMq8akQA24@localhost> User-Agent: KMail/4.8.2 (Linux/3.3.1-2; KDE/4.8.2; x86_64; ; ) In-Reply-To: References: <4F7B356E.9080003@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2012-04/txt/msg00459.txt.bz2 On Wednesday 11 of April 2012 11:43:36 Richard Guenther wrote: > > () The overloadable operator new means that memory can be > > _implicitly_ allocated in the right place. > > Implicit allocation is bad. In a compiler you want to _see_ where you > spend memory. in c++ you can overload new/delete operators for each class and track all these allocations with provided allocator. please consider following example: http://pastebin.com/UmBGWMTH you can bind polls, gc or anything else you want for any class and just use the new/delete keywords in sources as usual. in pure C you need to call the right malloc_*/free_* variants for each class. > > () Class hierarchies also mean that programmers can distinguish > > in the pointer types that a function needs a decl parameter, > > without having to say 'all trees' versus 'a very specific tree'. > > The static type checking avoids run-time bugs. > > True. In a very limited set of cases. C++ is not powerful enough > to express pointer-to-everything-that-would-be-considered-a-gimple-val. > Maybe C++ is not the right choice after all? (I suppose C++ concepts > would have helped here? pointer-to-tree-that-fulfils-is_gimple_val ... > (though is_gimple_val is not be a static property). hmm :) the c# provides a nice constraints engine (google the 'where' keyword) and the so-called duck-typing (c# 4.0) which might simplfy the source code that operates on ast nodes.