From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from icp-osb-irony-out7.external.iinet.net.au (icp-osb-irony-out7.external.iinet.net.au [203.59.1.107]) by sourceware.org (Postfix) with ESMTP id AA88D3857038 for ; Wed, 11 May 2022 17:44:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AA88D3857038 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=netspace.net.au Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=netspace.net.au IronPort-SDR: vOuogkzAq3uDZ3Tl8Z6iDeKKVjgSJ7kP72bqCE/5oI+1wUP39G6i9JYnmLASJ/MlfOF9IUL5vX KtGC361iRxwM9Becbmlywm91l2za69URMuJ74QUJEIoPddlINCZ489xQfsfB8YB3/pGkuzBDI3 OznQ/A0QP8S5maKh9ayzHTeFmCsPEzFrGHlOhNQYkbRvkbbOzf5j2/LRL/jT+/g61HrO/ED3DF XSwIUe3sKAlhC1WZrefcdQVdzm2D34+4H41D9uRLX2pc+9JqeoNgWojTmOA6oy085WboTJpeGH sWs= X-SMTP-MATCH: 1 IronPort-Data: A9a23:hPqH/6n2Pt2tbb9srUO4W8/o5gwuJERdPkR7XQ2eYbSJt1+Wr1Gzt xJOWziHP6mNZGT8fYh+OYi1oUMPscXSnd9kTFE++SxhRC4T+ZvOCOrCIxarNUt+DCFjoGGLT ik6QoOdRCzhZiaE/n9BClVgxJVF/fngqoDUUYYoAQgsA149IMsdoUg7wbRh39cx2YLR7z6l4 rseneWOYDdJ5BYpagr424rbwP+4lK2v0N+wlgVWicFj5DcypVFMZH4sDfjZw0/Df2VhNrXSq 9AvbV2O1jixEx8FUrtJm56nKRdSGua60QKm0hK6UID66vROjnBpiP5jbJLwZG8P4whlkeydx /1usbC9Rz4TZ5SWu8QSVjxUPA5SOYdJreqvzXiX6aR/zmX1Kiq2hawwXAdue9RIz46bA0kXp aRecmhVKEnS1qTnmtpXScE17ignBNPpJ4MWpVlmwC3CFf8tTNbFTrmM7MIwMDIY3ZEVQauAN ptFAdZpRE7fbjpuE0wYMY99n8mQwX2mdG1Dhl3A8MLb5ECWlmSdyoPFP9bfUseNWN9ek1mRv G+A+H72ajkBP9yAwDCt9nOqm/+KmH2rW8QVDrLQyxJxqATDnilJUEVTDArq5KjjzEKvXZReK koZ5mwooLR0/VHDosTBYiBUaUWs5nY0M+e82cVjgO1R4sI4OzqkO1U= IronPort-HdrOrdr: A9a23:d5U22aipEV5eMBiKy9f9NjTwXnBQXuEji2hC6mlwRA09TyX+rb HMoB1773/JYVkqMk3I9ersBEDiexLhHPxOjrX5VI3KNGLbVXOTXeVfBOPZsljd8kbFmNK1u5 0NT0CjYOeAdGST0q3BkW6F+nwbsb+6GduT9IXj80s= X-IronPort-AV: E=Sophos;i="5.91,217,1647273600"; d="scan'208";a="393456994" Received: from 180-200-199-92.dyn.iinet.net.au (HELO [192.168.0.18]) ([180.200.199.92]) by icp-osb-irony-out7.iinet.net.au with ESMTP; 12 May 2022 01:44:54 +0800 Message-ID: <6b12149e-141f-9426-f8c3-c38120fa8b1f@netspace.net.au> Date: Thu, 12 May 2022 03:44:52 +1000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: sizeof Content-Language: en-US From: Russell Shaw To: gdb@sourceware.org, Andreas Schwab References: <89fec0c3-8259-4951-5478-2afe6e0f1643@simark.ca> <0bc59583-bc2f-0ca7-e5eb-6f371ca402e1@netspace.net.au> <8735hh3l98.fsf@igel.home> <6772c7d9-8242-2946-3a74-9e6b05f9daf8@netspace.net.au> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham 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@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2022 17:45:01 -0000 On 11/5/22 18:16, Russell Shaw wrote: ... > "sizeof(int()) => 1" just seems wrong, but maybe it's a matter of taste that has > been explicitly decided. Despite all the proceeding, i don't think "sizeof(int())" should be sizeof ptr to function now. The objective of sizeof is for finding the size an item will be in an array of the items. sizeof(int[3]); => 12 sizeof(int()); => illegal "int()" is a legal type-id for a function, but you can't have an array of functions. "int()" could be decayed to a ptr "int(*)()", but that would be inconsistant with "int[3]" that you wouldn't want to decay. So i conclude that g++ is right by saying "warning: invalid application of ‘sizeof’ to a function type", and gdb should not say "sizeof(int())" => 1