all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: 43439@debbugs.gnu.org
Subject: bug#43439: [PATCH] doprnt improvements
Date: Fri, 18 Sep 2020 10:30:44 +0300	[thread overview]
Message-ID: <838sd75yor.fsf@gnu.org> (raw)
In-Reply-To: <31fb34a7-26c3-552d-e8d4-74624455ffcb@cs.ucla.edu> (message from Paul Eggert on Wed, 16 Sep 2020 15:09:50 -0700)

> Cc: 43439@debbugs.gnu.org
> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Wed, 16 Sep 2020 15:09:50 -0700
> 
> On 9/16/20 7:58 AM, Eli Zaretskii wrote:
> 
> > Emacs traditionally supports strings with
> > embedded null characters, and this feature is in line with that.  It
> > is true that it is currently unused, but why is it a good idea to
> > remove it?
> 
> It's a good idea not only because the feature is currently unused and its 
> support complicates and adds bugs to the code, but also because it would be a 
> bad idea to ever use the feature.
> 
> The Emacs feature is for Lisp strings. Emacs does not (and for API reasons, it 
> cannot practically) rely on embedded NULs in C strings. Among other things, if 
> we tried to use C-style printf formats with embedded NULs, GCC's warnings about 
> formats not matching their arguments would stop working. These GCC warnings are 
> quite useful for preventing bugs in Emacs's C code and have helped to catch many 
> such bugs, and we should not give them up.

How about a compromise: we modify doprint to exit when either it finds
NUL or reaches the character specified by FORMAT_END?  This will allow
us to keep some of the feature, and I think the amount of changes will
be smaller.  It should also not be much slower than what you propose.

> More generally, the vestigial support for NULs and %S in doprnt's C formats 
> dates back to long ago, before GCC warned about these features.

I understand your desire to have GCC warnings about this, but GCC is a
tool, it shouldn't dictate what features we keep and which ones we
drop.  We should do it the other way around.  doprnt callers don't
change much, so the GCC diagnostic features are not very important in
this case.

Thanks.





  reply	other threads:[~2020-09-18  7:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-16  1:50 bug#43439: [PATCH] doprnt improvements Paul Eggert
2020-09-16 14:58 ` Eli Zaretskii
2020-09-16 22:09   ` Paul Eggert
2020-09-18  7:30     ` Eli Zaretskii [this message]
2020-10-15 17:58       ` Paul Eggert
2020-10-15 18:12         ` Eli Zaretskii
2020-10-15 18:50           ` Paul Eggert
2020-10-15 19:05             ` Eli Zaretskii
2020-10-15 20:06               ` Paul Eggert
2020-10-17 18:32                 ` Eli Zaretskii
2020-10-18  2:24                   ` Paul Eggert
2020-10-24 10:39                     ` Eli Zaretskii
2020-10-24 21:02                       ` Paul Eggert

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

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

  git send-email \
    --in-reply-to=838sd75yor.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=43439@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.