From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 17818 invoked from network); 12 May 2020 18:37:19 -0000 Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with ESMTPUTF8; 12 May 2020 18:37:19 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id D42169C692; Wed, 13 May 2020 04:37:16 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 046639C669; Wed, 13 May 2020 04:36:43 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="kq2Jgy1N"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id 033909C669; Wed, 13 May 2020 04:36:41 +1000 (AEST) Received: from mail-ua1-f46.google.com (mail-ua1-f46.google.com [209.85.222.46]) by minnie.tuhs.org (Postfix) with ESMTPS id 964C29C668 for ; Wed, 13 May 2020 04:36:40 +1000 (AEST) Received: by mail-ua1-f46.google.com with SMTP id k13so4760015uap.13 for ; Tue, 12 May 2020 11:36:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=EDM7vgjdsKsWM9LONsYn1DfxHzdFAYjaT4pWroof3TE=; b=kq2Jgy1NJqLuroNiYhnE9iuUKr0lnySVzRyV23+GNqscdyKhJFa050hXwNYcYwr8Sr deE+NMv9AEXB7PSTGUVY1g8KktpLl5Tcp2Fej8Y807WdKzIZpqDXpLUMKhJSYa+x/g0W 9i6DeGNxd6WzjRcZ2cseciH9mTAF+5xsKoTCXGcaqRzRJ3ywQe8NkQBeqY3+mUAM5Seu 5DJBe7nUGq864OPPNLKYOybNVYAOlG1Za/qTmgVCGwPAaz6MtDQSsxxRpjlrq2kDohAP sIE2tHM7LS/ccBt8qzMqUgpnTOfMLI7xTzlRFjrfBx0lKwEXSbF5y7gTikXKaotaoez5 yQwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=EDM7vgjdsKsWM9LONsYn1DfxHzdFAYjaT4pWroof3TE=; b=rnl/uUOPu6Ku8uLiSJk9PRGV/8gO2c1yKOgWxIa845m7aHjX3RitI3boCxmGGfHj1f Sliz+JlCQ3lEQzQQEKp8WGWECGXgiI7Nrj0SUqtTnQ8y3TYO18QmImodBGLO0zGrBJ1m 7F0sTIrYkdXu3vlIgdtW83086ILTWjGrs7/4pywwIMe/2OgwP1QkIvhJ9LEcWigwrNcO CxQzIu6wvw5z1uWMAomLlXLFCj2qtNXQXm/XIOBsSdCZeAkYzmA5OT2PPUj5EBelCRkf DWKsc0rbn+5t4iIecDy9yjtyMFFycVALkENU4HasFhaO2uXmlrtvSM19kK8HFmG+xGGP lnKw== X-Gm-Message-State: AGi0PuYIvhrEkY1GgvbzHTretswxAXR5fZ3Nfb3f+rQoFvOlPJ8pHI7/ STwqaMCorKNbfANad2tWVm8RNziBxdIuhYBA1ec40Q== X-Google-Smtp-Source: APiQypJQh4Ak9jvKp5GSla9tYHk0UTAcjSS5jSteLXV2hnC16vN/+8F4pCj9DmI10ITYcZa37WEICY4uDc82IoIx4sA= X-Received: by 2002:ab0:2c0b:: with SMTP id l11mr18362798uar.110.1589308599244; Tue, 12 May 2020 11:36:39 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab0:4717:0:0:0:0:0 with HTTP; Tue, 12 May 2020 11:36:38 -0700 (PDT) In-Reply-To: References: <3cb1126796176debe28aa66672ba27ae@yaccman.com> <20200511005745.GL17035@mcvoy.com> <357EFE54-BD94-4C10-8C43-C6735BF7D317@via.net> <20200511202555.GU17035@mcvoy.com> From: Paul Winalski Date: Tue, 12 May 2020 14:36:38 -0400 Message-ID: To: The Unix Heritage Society mailing list Content-Type: text/plain; charset="UTF-8" Subject: Re: [TUHS] v7 K&R C X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" On 5/12/20, ron@ronnatalie.com wrote: >> On 5/11/20, Larry McVoy wrote: > >> o all std:: and STL functions >> >> The last two of these are mainly for performance reasons. throw and >> catch play merry hell with compiler optimizations, especially of >> global variables. > > You'll have to explain to me how templates or the standard library (which > by the way includes all of the C stuff) affects performance. In fact, we > use templates to INCREASE rather than decrease performance. Templating > is almost entirely compile time rewrites. The C++ standard libraries make heavy use of throw/catch exception handling. If routine A calls routine B, and B is known by the compiler to have the capability to throw exceptions, a bunch of important optimizations can't be done. For example: o You can't keep global values in registers around the call to B because the handler that catches an exception that B throws might use that global variable. So you have to spill the value around the call. o You can't do value propagation of global variables around the call to B because a handler might change their values. And it gets a lot worse when you start doing parallel loop execution. I implemented a new design for exception handling in a C/C++ compiler back end, and I found lots of corner cases where the C++ standard was silent as to what should happen when exceptions are thrown or caught from parallel threads. Things such as the order of execution of constructors and destructors for parallel routines when a thrown exception is unwound, and which side of the parallelization executes constructors and destructors under those conditions. The committee just plain never considered those issues. -Paul W.