From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA15ACA9EA9 for ; Fri, 18 Oct 2019 23:01:20 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6FAF520700 for ; Fri, 18 Oct 2019 23:01:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6FAF520700 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=vt.edu Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=kernelnewbies-bounces+kernelnewbies=archiver.kernel.org@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.92.3) (envelope-from ) id 1iLbFH-0002LQ-FD for kernelnewbies@archiver.kernel.org; Fri, 18 Oct 2019 19:01:19 -0400 Received: from omr2.cc.ipv6.vt.edu ([2607:b400:92:8400:0:33:fb76:806e] helo=omr2.cc.vt.edu) by shelob.surriel.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) (envelope-from ) id 1iLbDL-0000AP-Ly for kernelnewbies@kernelnewbies.org; Fri, 18 Oct 2019 18:59:19 -0400 Received: from mr4.cc.vt.edu (mr4.cc.ipv6.vt.edu [IPv6:2607:b400:92:8300:0:7b:e2b1:6a29]) by omr2.cc.vt.edu (8.14.4/8.14.4) with ESMTP id x9IMxH7K029839 for ; Fri, 18 Oct 2019 18:59:18 -0400 Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by mr4.cc.vt.edu (8.14.7/8.14.7) with ESMTP id x9IMxCw2020888 for ; Fri, 18 Oct 2019 18:59:17 -0400 Received: by mail-qt1-f198.google.com with SMTP id i25so491565qtm.17 for ; Fri, 18 Oct 2019 15:59:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:in-reply-to:references :mime-version:content-transfer-encoding:date:message-id; bh=/MudgLybjCJ0PzCuenn6sMu+WFugvRJC8Gh3qMKq1zQ=; b=We+LUwFPZd4xG5Fk7+2CtsxtgPNgzZIJcfhvRW6JktBEHVdasvH3YLOz+4yjtfTPt+ 1zCKt+Z73+KgxeWTBXotjXmsRJ2F2k8+HODsp/gmiPCrv+b4C6r+9YkB1lHNWQOwMrdq zxThkpyfKkXETpJfzGu4sQTzlbzQKOfGoG0p5T97up+upJ9xQyByRBWK99HXECq4B3Oj DD+j80KZeMYiBbVHma8JEbaVC/0cpsOCRU0kf457UIc27CavEnO3xVwbAwHQM8Ax0GPh KEOOWfxaVcJn33BXw4/+1EdPPp6rK90L/MgqIkUGMqlICAI32h+XCu1tItryKLRvuLEb FdtQ== X-Gm-Message-State: APjAAAXqKjnKPe+bWAO662yuJZS1YKmtHquId4ScwplGxY44aiKxewoI dCIJeSnBr9OZgRyu5/X/MeIeFhnPNHYbrX+leKkFFzDaKxUV4H95XPgak1jaPZLqtAFjw4o5o9r Vshlm1S7e3KCLtxyr1HesDIye2q6deX4ZvcqPVr8= X-Received: by 2002:a0c:b068:: with SMTP id l37mr12346536qvc.36.1571439551767; Fri, 18 Oct 2019 15:59:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqxuzyDTwhnEmZou+nb4pXrq/u7sqq0BuT0fEDSFHQyK6c8zuiEsGfNpvHtWWyLRAtlIbzp14g== X-Received: by 2002:a0c:b068:: with SMTP id l37mr12346516qvc.36.1571439551294; Fri, 18 Oct 2019 15:59:11 -0700 (PDT) Received: from turing-police ([2601:5c0:c001:4341::9ca]) by smtp.gmail.com with ESMTPSA id c185sm3584797qkg.74.2019.10.18.15.59.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 15:59:09 -0700 (PDT) From: "Valdis Kl=?utf-8?Q?=c4=93?=tnieks" X-Google-Original-From: "Valdis Kl=?utf-8?Q?=c4=93?=tnieks" X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7+dev To: Martin Galvan Subject: Re: Try/catch for modules? In-Reply-To: References: <29246.1571350377@turing-police> Mime-Version: 1.0 Date: Fri, 18 Oct 2019 18:59:08 -0400 Message-ID: <130269.1571439548@turing-police> Cc: kernelnewbies@kernelnewbies.org X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============7220342710438480124==" Errors-To: kernelnewbies-bounces+kernelnewbies=archiver.kernel.org@kernelnewbies.org --===============7220342710438480124== Content-Type: multipart/signed; boundary="==_Exmh_1571439548_13653P"; micalg=pgp-sha1; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit --==_Exmh_1571439548_13653P Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Fri, 18 Oct 2019 12:43:58 -0300, Martin Galvan said: > goto statements are harmful. For starters, note that the original paper was written in 1968. Yes, it's= over a half century old now. Have you actually *read* the paper? https://homepages.cwi.nl/=7Estorm/teaching/reader/Dijkstra68.pdf You probably want to keep in mind that in 1968, most languages in widespr= ead use (in other words, Fortran and COBOL, effectively) did *not* have any c= oncept *at all* of =22structured programming=22 supported by language syntax.=20 Fortran had exactly one explicit iterative syntax, the DO loop, which was= a subset of the C for loop. It also had the infamous and dangerous 'arithmetic if' statement, which w= as of the format 'if (condition) A,B,C' - which was a *three* way goto to label= s A B or C depending if 'condition' was negative, zero, or positive. Yes, this= meant that the following statement *had* to have a goto target label on it in o= rder to be reachable code. There was also 'GOTO A,B,C,...,integer variable', which would branch to label A if the variable was 1, B if it was 2, etc... And the creeping horror known as 'assigned goto'. ASSIGN 10 TO N=20 ...=20 GO TO N ( 10, 20, 30, 40 )=20 ...=20 10 CONTINUE=20 ...=20 40 STOP Now imagine a large subroutine that takes most of a box of punched cards,= and 5 or 6 different variables containing assigned targets, and the GOTO can = branch to *anywhere* in the current compilation unit. (If that isn't bad enough, the IBM Fortran IV G compiler included an exte= nsion called 'debug units', which *really* *did* have the semantics of the joke= statement 'COME FROM'.) Fortran wouldn't get a 'while' for another 15 years or so. And the COBOL= 'PERFORM' verb is best not approached without first fortifying yourself with stron= g drink. That was the reality that Dijkstra was writing about at the time. Also consider where Dijkstra's head was when he wrote the paper, which al= so includes this statement: =22Let us now consider repetition clauses (like, while B repeat A or repe= at A until B). Logically speaking, such clauses are now superfluous, bcause we= can express repetition with the aid of recursive procedures.=22 Yeah. Exactly. Let's return to 2019. Feel free to look at function hi_command() in drivers/media/dvb-frontends= /drx39xyj/drxj.c and re-write it in standard nested if/then/elseif/then/elsif/then... form= . Watch out for the fact that the case statement uses fallthroughs. Let us= know the maximum number of leading tabs your version uses. Another good challenge is to unsnarl the gotos in the TLV_PUT macros in fs/btrfs/send.c into a form that doesn't use goto. There's plenty of good reason to use goto's when implementing a finite state machine. At some point, purity needs to take a back seat to pragmatism. --==_Exmh_1571439548_13653P Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Comment: Exmh version 2.9.0 11/07/2018 iQIVAwUBXapDvAdmEQWDXROgAQIljA/+NukqSvLnMSim2QhHM3VLqhQPDmBPMMdp ckT6ulWcgqMrcn3t8tz4rdo5JCEIEYlNZaW43ZOwou9uk4bSc7FPnnCWO3ba8PDy NRC3ZTNbmKLWeKk6whBjYwujNXJdkFR0cVkPT/6cGyFnUjD9vHHJs0g8KyofRT1u I7yQ4SctNpRH8bTtAeRY+Fp80MKf80WYV47gfs9w0r+f+Zi8y29Q6wikIiqlqQxS +GQqXE6C5UAWWUFTyo7wmPSB8x3F/otsRTEWLZKIOFpdLzjHJK4Ij9fk+q17o3B8 Tg41Gs+UbJ2OCWHmfX+Z9EPv/OvEMW2LQ1DtHCqG48T8NfYqut2KuoDselvoB2vw IqjYo4K34Dkn7M04jP/8tmPVEWrVr2t1ZjhEGihZEi9crPfo7EBypT+9BQ5Zm27X SZmJA5xfQF3HM4i1jNy6o7pfDZfYQv9XAQs60jmqOrDAdACfTYAtMYUg1Fm6tt/g zqP4LRyrJ01RR+bGLuYoYf96C28EdXC+IIIX53iIGNEUszFWk6NSxR9QG5c0ObDK mHEJjieXK5i7zoOj4lC0QHl36JUAQ1ci8Q8jkP310308eGhogoXZEB7S7kUzn+1/ 15nnnUk396wsQHRw+OxDzoMUvnRQk4t48SWSxqFXxumFZyggy5mL/wGQc/+0GO3n PVvfF8HZi4U= =CORO -----END PGP SIGNATURE----- --==_Exmh_1571439548_13653P-- --===============7220342710438480124== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies --===============7220342710438480124==--