unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Magne Ingebrigtsen <larsi@gnus.org>
To: emacs-devel@gnu.org
Subject: Re: Emacs-diffs Digest, Vol 94, Issue 89
Date: Sat, 25 Sep 2010 15:19:37 +0200	[thread overview]
Message-ID: <m3aan6q7ti.fsf@quimbies.gnus.org> (raw)
In-Reply-To: 83iq1us2hx.fsf@gnu.org

Eli Zaretskii <eliz@gnu.org> writes:

>> >> -  int frame_lines = FRAME_LINES (frame);
>> >> +  EMACS_INT frame_lines = FRAME_LINES (frame);

[...]

> So what is the practical guidance to Lars and others who go by the
> warnings emitted by -Wconversion?  Will the below be okay, for when an
> small-valued EMACS_INT is assigned to an int:
>
>  . if the source is EMACS_INT, consider making it an int; if that's
>    not possible, cast to int, preferably inside a macro
>
>  . if the source is a Lisp_Object passed through XINT, cast to an int,
>    preferably inside an accessor macro

So in this case FRAME_LINES should cast to an int before returning?
Makes sense to me, and I can redo the stuff in that file based on that. 

Or just make these into ints:

  /* Size of this frame, excluding fringes, scroll bars etc.,
     in units of canonical characters.  */
  EMACS_INT text_lines, text_cols;

It does seem rather nonsensical to have them be EMACS_INT...

Which reminds me about a question about characters.  Can they really be
longs?  Let's see...

DEFUN ("char-resolve-modifiers", Fchar_resolve_modifiers,
...
  (Lisp_Object character)
{
  int c;

  CHECK_NUMBER (character);
  c = XINT (character);
  return make_number (char_resolve_modifier_mask (c));
}

Hm.  In that case it should perhaps actually be EMACS_INT, since the
character comes from "user space".  So that's a bad example.  :-)  But
the general question is whether characters can be longs still stand, and
whether there then should be like an XCHAR macro that does the same as
XINT, but casts to int.  

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




  reply	other threads:[~2010-09-25 13:19 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1OzCq2-00008v-RR@eggs.gnu.org>
2010-09-24 19:00 ` Emacs-diffs Digest, Vol 94, Issue 89 Eli Zaretskii
2010-09-24 19:41   ` Lars Magne Ingebrigtsen
2010-09-24 19:50     ` Eli Zaretskii
2010-09-24 20:19       ` Eli Zaretskii
2010-09-24 20:29         ` David Kastrup
2010-09-25  7:25           ` Eli Zaretskii
2010-09-25  7:50             ` David Kastrup
2010-09-24 22:08         ` Chong Yidong
2010-09-25 20:05           ` Stefan Monnier
2010-09-24 22:25   ` Stefan Monnier
2010-09-25  7:31     ` Eli Zaretskii
2010-09-25 13:19       ` Lars Magne Ingebrigtsen [this message]
2010-09-25 13:28         ` Eli Zaretskii
2010-09-25 20:09       ` Stefan Monnier
2010-09-25 20:30         ` Lars Magne Ingebrigtsen
2010-09-25 22:09           ` Eli Zaretskii
2010-09-26 21:52             ` Stefan Monnier
2010-09-27 15:33               ` Chong Yidong
2010-09-27 16:23                 ` Lars Magne Ingebrigtsen
2010-09-27 20:59                   ` Stefan Monnier
2010-09-27 21:10                     ` Lars Magne Ingebrigtsen
2010-09-27 21:21                       ` Andreas Schwab
2010-09-28  5:47                         ` Eli Zaretskii
2010-09-28  9:26                           ` Lars Magne Ingebrigtsen
2010-09-28 22:35                             ` Stefan Monnier
2010-09-29 13:15                           ` Davis Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3aan6q7ti.fsf@quimbies.gnus.org \
    --to=larsi@gnus.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).