From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Override Windows default Win-* key combinations when using Emacs Date: Fri, 15 Jan 2016 15:23:56 +0600 Message-ID: References: <568BBC58.50702@aprikoodi.fi> <83y4c43qkh.fsf@gnu.org> <5691667C.5000009@aprikoodi.fi> <838u3wkkvb.fsf@gnu.org> <5694E07E.8010005@aprikoodi.fi> <83fuy2kd2w.fsf@gnu.org> <56961607.2090504@aprikoodi.fi> <569634D6.6030404@aprikoodi.fi> <83oacpiial.fsf@gnu.org> <5697995B.5010306@aprikoodi.fi> <83mvs8gh7n.fsf@gnu.org> <56989810.70301@aprikoodi.fi> <5698A546.8020701@aprikoodi.fi> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1452849867 5642 80.91.229.3 (15 Jan 2016 09:24:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 15 Jan 2016 09:24:27 +0000 (UTC) Cc: Eli Zaretskii , Emacs developers To: Jussi Lahdenniemi Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 15 10:24:27 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aK0cM-0000Au-2s for ged-emacs-devel@m.gmane.org; Fri, 15 Jan 2016 10:24:26 +0100 Original-Received: from localhost ([::1]:46058 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK0cL-0005IX-9L for ged-emacs-devel@m.gmane.org; Fri, 15 Jan 2016 04:24:25 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53544) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK0cH-0005IP-MN for emacs-devel@gnu.org; Fri, 15 Jan 2016 04:24:22 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aK0cG-0004gP-Lp for emacs-devel@gnu.org; Fri, 15 Jan 2016 04:24:21 -0500 Original-Received: from mail-lb0-x233.google.com ([2a00:1450:4010:c04::233]:33037) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK0cF-0004g0-1G; Fri, 15 Jan 2016 04:24:19 -0500 Original-Received: by mail-lb0-x233.google.com with SMTP id x4so55087920lbm.0; Fri, 15 Jan 2016 01:24:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=oPAljwxUs031WCVJpaTS4cVQzsceAgvO5NBrJrN3nts=; b=cbMUbokDrhGjPXBg8gfg2hGbiwo5RW74/dE+s8UTKIGNxleIbp2fFd7vQmTV96BAuy rmjqyLZnWIUR38EFFY8M9S2KAh6ZCIqfZau0nXRhXGFm0QqQ9tcL8RAG3Nv7wWAtaqe1 UnJUGg972wBCqtkU4A5lS0glVMb9O6yMZ/n3XfSgbstt6raWi2WvDWD+38CxUIEqjMsI bhYi1boOKWjlhah9kdSDRiAxtkht7cjOLqTY7e8T9WFvzW2zSUv4ZQn8e3kRxEzkM1bP s32q9R7FQStNoxv8LBIZfzglYk3Od9KUYqWUZEWohc3RYSZuS18INr1Z8h6D0/w7M4Dt lA8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=oPAljwxUs031WCVJpaTS4cVQzsceAgvO5NBrJrN3nts=; b=P4KUNfchfpCyKCcxZ2+xBQTD1UISLPmetCYJLosCWUOaDlvGqQOQ52yLl/PLY3KHnF hTYA0OIs7fqc0IqAnJOMUYVwZr/AsARoGVRqtSQe8sOLRojNNe7b+7dgwvR5rdmSMUBc T/Pwu2mUgtEuYR2Y6EtCJUIaTV3+GyaD1GsAHLA/x8d52/zV6K6QnPArvYC4WHm1U4Sc LzBxuom6Z9/HXfUSq2Kow+P59vsyrG5aExMQPAbP1cdFiLFeYEg/hlacFvQ5dam84U9O JUAlvdR6gSJCCyayF570o6rwz0Awf6h4UK4sMEBf55W+ZbKCe0e38hRQZ/IhQNK1xX9d tThA== X-Gm-Message-State: ALoCoQkSbrnV5EpWgnYZLDzZat/WIZ19Kd5zQVEavQXIlbeG/4ldlVZ+eQvNbC11w0doxEm1s0jEoWG81WPgcNkdqnyS0QS4AA== X-Received: by 10.112.168.5 with SMTP id zs5mr2942662lbb.56.1452849857879; Fri, 15 Jan 2016 01:24:17 -0800 (PST) Original-Received: by 10.112.129.163 with HTTP; Fri, 15 Jan 2016 01:23:56 -0800 (PST) In-Reply-To: <5698A546.8020701@aprikoodi.fi> X-Google-Sender-Auth: wZIhP1Rer-Z6wJL81Wzhppxwwxc X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c04::233 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:198173 Archived-At: On Fri, Jan 15, 2016 at 1:52 PM, Jussi Lahdenniemi wro= te: > So, apparently, on Windows 98 HeapAlloc does not guarantee 8-byte alignme= nt > of memory. Not that this would be documented anywhere... By the Rules As Written, absence of a documented minimum alignment should be interpreted as permission for the implementation to return any unaligned addresses. In practice, a particular implementation of HeapAlloc is likely to satisfy the requirements of C=E2=80=99s malloc and C++=E2=80=99s operator n= ew, which guarantee alignment suitable for any object. On a 32-bit x86 system, 4-byte alignment is not strictly required for 32-bit quantities, but gives a performance benefit, so HeapAlloc is likely to yield 4-byte-aligned blocks. > How should we fix this? I can write and test the fix, but I'd like to he= ar > your opinion on the preferred mechanism. I have seen one library implement an aligned allocator this way: * When a block of size N aligned to A bytes is requested, allocate an unaligned block of size N + sizeof(void*) + (A - 1). Let=E2=80=99s call its starting address P. Calculate the result address P' as (P + sizeof(void*) + (A - 1)) & ~(A - 1). Store the value of P at address P' - sizeof(void*). Return P'. * When the aligned block at address P' is freed and P' is not null, read the pointer value P from address P' - sizeof(void*). Free the unaligned block starting at P. (Obviously this scheme is not particularly efficient for small allocations.= )