emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: buffer.c/buffer.h: How to add new buffer-local variables?


From: Eli Zaretskii
Subject: Re: buffer.c/buffer.h: How to add new buffer-local variables?
Date: Tue, 02 Apr 2019 19:18:43 +0300

> From: Andreas Schwab <address@hidden>
> Date: Sun, 31 Mar 2019 13:41:51 +0200
> Cc: Keith David Bershatsky <address@hidden>, address@hidden
> 
> On Mär 31 2019, Eli Zaretskii <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]