From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by sourceware.org (Postfix) with ESMTPS id 3917C3858D20 for ; Thu, 3 Mar 2022 18:52:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3917C3858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f44.google.com with SMTP id t11so9264716wrm.5 for ; Thu, 03 Mar 2022 10:52:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=2mF7Q5x9KaBK0n967ycoc/9Keq4QcZr/v74cKF+NEBs=; b=SwuAK6+7WWuiTYKQbBzMJ/T75xt/ET9gqCdy8PT5P9AzCsjw5peUU8ZuMpM3tCeH8O POv0eL8SrnfxH5O2IACymIt/E7HJvFS+xBXkm1mb6ws9BIh9ZYSomK9XecfOcBfLPv0/ H/1fUgl15qU/tiFqqwcFL8p+cVmcdp0DEV3KablQlRXtJy1vNFzCntaKCck5d+2zIhP8 JUsqDTWxOLGPzc8Nb5g9+0gJkqYC1eP155pi6YlVrr2STkOgR0tws2KYVV4EoztTcv7C Jc5YveXB9QodGnG6jcTy+hDF5KL+vuza+zfpvy3slwsJGrkaU0dj4sQrJ6wFKi2aJnlG pLDQ== X-Gm-Message-State: AOAM531JEZvva5hPzNCS00ss73Q8p2oE2rHJ/LksVlGoJqWjaIZDF3vN DbK5zZCc59Y3glo//ZCMF5/27Fmu5I4= X-Google-Smtp-Source: ABdhPJzG8rZSheNDoKkpH2IOW9mH0VIsi2y/pVDJRKkW27IxAMP83fkRy+nrZR0i0WR3uGTrysk0HQ== X-Received: by 2002:adf:b64c:0:b0:1e3:16d0:3504 with SMTP id i12-20020adfb64c000000b001e316d03504mr27858772wre.333.1646333524277; Thu, 03 Mar 2022 10:52:04 -0800 (PST) Received: from ?IPV6:2001:8a0:f924:2600:209d:85e2:409e:8726? ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id r16-20020a5d4e50000000b001f0075f4ca1sm2731968wrt.105.2022.03.03.10.52.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Mar 2022 10:52:03 -0800 (PST) Message-ID: <8cadd6ec-84d2-25dd-4209-17d479bc0094@palves.net> Date: Thu, 3 Mar 2022 18:52:02 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCHv2 05/15] gdb/tui: add new 'tui window width' command and 'winwidth' alias Content-Language: en-US To: Andrew Burgess , gdb-patches@sourceware.org References: <81ab0df3eebc4d865d9e63e49a1eab84e7970a6a.1644156219.git.aburgess@redhat.com> From: Pedro Alves In-Reply-To: <81ab0df3eebc4d865d9e63e49a1eab84e7970a6a.1644156219.git.aburgess@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Mar 2022 18:52:06 -0000 On 2022-02-06 14:12, Andrew Burgess via Gdb-patches wrote: > As for the changes in gdb itself, I've mostly just templated the > existing height adjustment code so that the two functions > tui_layout_split::adjust_size (tui-layout.c) and > tui_set_win_height_command (tui-win.c) now have a template parameter > "policy", this policy allows me to specialise the functions for either > width or height adjustment. Function arguments, and locals, are > renamed, replacing 'height' with 'size'. Do you envision that there will be more policies going forward, other than width and height? Template policies are a good thing when the number of policies is open ended, such as with library utility classes where you want the user of the utility be able to configure your type. But here, you only have two modes of operation and they are totally known upfront, which seems like could be just as well handled with a bool or enum. The disadvantage of the policy approach is that leads to code bloat, as the compiler basically duplicates the functions.