From owner-freebsd-hackers@FreeBSD.ORG Sat Jul 15 19:47:37 2006 Return-Path: X-Original-To: freebsd-hackers@FreeBSD.ORG Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 466A216A4DE for ; Sat, 15 Jul 2006 19:47:37 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id D3CCA43D46 for ; Sat, 15 Jul 2006 19:47:36 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost.village.org [127.0.0.1] (may be forged)) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id k6FJihkY042628; Sat, 15 Jul 2006 13:44:44 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sat, 15 Jul 2006 13:44:56 -0600 (MDT) Message-Id: <20060715.134456.63053925.imp@bsdimp.com> To: joerg@britannica.bec.de From: "M. Warner Losh" In-Reply-To: <20060714074419.GC14113@britannica.bec.de> References: <20060712132059.GA3906@britannica.bec.de> <20060714074419.GC14113@britannica.bec.de> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Sat, 15 Jul 2006 13:44:44 -0600 (MDT) Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: kern/99979: Get Ready for Kernel Module in C++ X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jul 2006 19:47:37 -0000 In message: <20060714074419.GC14113@britannica.bec.de> Joerg Sonnenberger writes: : On Thu, Jul 13, 2006 at 11:16:18AM +0530, Kamal R. Prasad wrote: : > Im sorry I didn't understand you. setjmp() stores a few register contents : > [notably ip] in a jmpbuf -which are restored after a longjmp(). How is the : > try/catch mechanism more efficient than a setjmp()/longjmp() in terms of : > space/time complexity? : : Because you have to run setjmp for *every* try{}, independent of whether : it is ever actually needed. It is worse than even that. You have to run setjmp for every frame, because there could be an exception thrown from a lower frame to an upper frame and you have to cleanup your frame when that happens. Variables go out of scope, and must be destructed, etc. Warner