[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Compiling Elisp to a native code with a GCC plugin
From: |
Eli Zaretskii |
Subject: |
Re: Compiling Elisp to a native code with a GCC plugin |
Date: |
Fri, 17 Sep 2010 18:39:50 +0200 |
> From: Lars Magne Ingebrigtsen <address@hidden>
> Date: Fri, 17 Sep 2010 18:24:34 +0200
>
> The thing I'm must unclear on now is whether it's valid to say
>
> int thing = PT;
>
> and whether it's valid to say
>
> PT + 1;
PT is just a number, an integral data type. So adding one to it is
okay. But storing into an `int' is not, because PT is an EMACS_INT,
see `struct buffer':
struct buffer
{
...
/* Char position of point in buffer. */
EMACS_INT pt;
/* Byte position of point in buffer. */
EMACS_INT pt_byte;
EMACS_INT is a 64-bit data type on 64-bit machines, so assigning it to
an int is a bug waiting to happen. You should do this instead:
EMACS_INT thing = PT;
> I've grepped through the code, and this seems to be used all over the
> place
Each place where you see PT assigned to an int is a bug, please either
report it or fix it right away.
> so I'm guessing that perhaps the size of a buffer is constrained
> to be less than INT_MAX?
No, it's constrained by most-positive-fixnum (MOST_POSITIVE_FIXNUM in
C), but we still have many places where we use a int, which is why
buffers larger than MAX_INT not always work well.
- Re: Compiling Elisp to a native code with a GCC plugin, (continued)
- Re: Compiling Elisp to a native code with a GCC plugin, David Kastrup, 2010/09/18
- Re: Compiling Elisp to a native code with a GCC plugin, Stephen J. Turnbull, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, Eli Zaretskii, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, Stephen J. Turnbull, 2010/09/18
- Re: Compiling Elisp to a native code with a GCC plugin, Eli Zaretskii, 2010/09/18
- Re: Compiling Elisp to a native code with a GCC plugin, Stefan Monnier, 2010/09/18
- Re: Compiling Elisp to a native code with a GCC plugin, Lars Magne Ingebrigtsen, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, David Kastrup, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, Eli Zaretskii, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, Lars Magne Ingebrigtsen, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin,
Eli Zaretskii <=
- Re: Compiling Elisp to a native code with a GCC plugin, Lars Magne Ingebrigtsen, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, Eli Zaretskii, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, Eli Zaretskii, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, Andreas Schwab, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, Lars Magne Ingebrigtsen, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, Wojciech Meyer, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, Andreas Schwab, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, Lars Magne Ingebrigtsen, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, Andreas Schwab, 2010/09/17
- Re: Compiling Elisp to a native code with a GCC plugin, Lars Magne Ingebrigtsen, 2010/09/17