From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: buffer.c/buffer.h: How to add new buffer-local variables? Date: Tue, 02 Apr 2019 19:18:43 +0300 Message-ID: <83imvwfkik.fsf@gnu.org> References: <5A3C6A89-2360-46CF-8049-828A4B955445@gnu.org> <875zrzclts.fsf@igel.home> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="129452"; mail-complaints-to="usenet@blaine.gmane.org" Cc: emacs-devel@gnu.org To: Daniel Colascione Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 02 18:19:32 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hBM8I-000XUQ-Ti for ged-emacs-devel@m.gmane.org; Tue, 02 Apr 2019 18:19:31 +0200 Original-Received: from localhost ([127.0.0.1]:48153 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBM8H-00074W-Os for ged-emacs-devel@m.gmane.org; Tue, 02 Apr 2019 12:19:29 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:34422) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBM7L-00072y-UC for emacs-devel@gnu.org; Tue, 02 Apr 2019 12:18:32 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:42251) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBM7L-0005y2-EX; Tue, 02 Apr 2019 12:18:31 -0400 Original-Received: from [176.228.60.248] (port=2593 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hBM7K-0006tz-G3; Tue, 02 Apr 2019 12:18:30 -0400 In-reply-to: <875zrzclts.fsf@igel.home> (message from Andreas Schwab on Sun, 31 Mar 2019 13:41:51 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:234874 Archived-At: > From: Andreas Schwab > Date: Sun, 31 Mar 2019 13:41:51 +0200 > Cc: Keith David Bershatsky , emacs-devel@gnu.org > > On Mär 31 2019, Eli Zaretskii wrote: > > > So you are saying that the 1024 value is arbitrary and should be enlarged when more local vars are added? > > No. Daniel, could you please help me understand why the value 1024 was used here: static dump_off field_relpos (const void *in_start, const void *in_field) { ptrdiff_t in_start_val = (ptrdiff_t) in_start; ptrdiff_t in_field_val = (ptrdiff_t) in_field; eassert (in_start_val <= in_field_val); ptrdiff_t relpos = in_field_val - in_start_val; eassert (relpos < 1024); /* Sanity check. */ <<<<<<<<<<<< return (dump_off) relpos; } The comment says "sanity check", but I would like to understand what kind of sanity is being checked here, and what should be done when some structure we dump becomes larger than this value. E.g., is there some other limit that requires that offsets of dumped fields never exceed 1024 here? I'd like to document in comments what to do when the assertion is violated. TIA