Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1NhUcF-00069M-Ec for mharc-grub-devel@gnu.org; Tue, 16 Feb 2010 16:05:55 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NhUcD-000675-Tq for grub-devel@gnu.org; Tue, 16 Feb 2010 16:05:53 -0500 Received: from [140.186.70.92] (port=43034 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NhUcD-00065e-0U for grub-devel@gnu.org; Tue, 16 Feb 2010 16:05:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NhUcC-0000UB-5M for grub-devel@gnu.org; Tue, 16 Feb 2010 16:05:52 -0500 Received: from mail-fx0-f215.google.com ([209.85.220.215]:48869) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NhUcB-0000U7-Um for grub-devel@gnu.org; Tue, 16 Feb 2010 16:05:52 -0500 Received: by fxm7 with SMTP id 7so6846861fxm.8 for ; Tue, 16 Feb 2010 13:05:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to :content-type:content-transfer-encoding; bh=V9AC+Qlk/VkxZBGW1UaCPxoH5apLHm5XHdosEm7AAvw=; b=menPe6eo18g/Rjw9QLLew1kBKd9u82wTUZYxNPGBLLMzfgL6YqnE02eU4rBtZ2GUfP O2LrM9Oh3w73TfF2qz9mr5sa7+w6MyVWPTvLI8zC4VjRQRfke1jLmmd9aAtP30ASbSDn p7rY7+hcoeYQMI2FF34/hAHa6lx3eZuOUSw7c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type :content-transfer-encoding; b=DT6NhhJXEa5j0Ftixc3q/dK/ZbpzQCnO+wbs3SWYP0jbt9bgHqFrhUz+9cSgQDz+wO a59xqp6dsmBrqiSKnl/QQcT50EPq7n8cvWXxpAu63pCLa9hWo2Mg95u7Z6CC83T+M5M8 RJgjFsU5qmOIaosH2qgIHMVAErF5b/BQoFMCc= MIME-Version: 1.0 Sender: hramrach@gmail.com Received: by 10.239.168.9 with SMTP id i9mr775046hbe.76.1266354350888; Tue, 16 Feb 2010 13:05:50 -0800 (PST) In-Reply-To: <4B7AC60B.1060804@gmail.com> References: <4B736F82.7010005@gmail.com> <4B7AC60B.1060804@gmail.com> From: Michal Suchanek Date: Tue, 16 Feb 2010 22:05:30 +0100 X-Google-Sender-Auth: e2abb98e143f2310 Message-ID: To: The development of GNU GRUB Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: [RFC] Framebuffer rotation patch X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2010 21:05:54 -0000 2010/2/16 Vladimir '=CF=86-coder/phcoder' Serbinenko : > Michal Suchanek wrote: >>> With typeof macro this can be made type-neutral avoiding potential mist= akes. >>> +static inline long >>> +grub_min (long x, long y) >>> +{ >>> + =C2=A0if (x > y) >>> + =C2=A0 =C2=A0return y; >>> + =C2=A0else >>> + =C2=A0 =C2=A0return x; >>> +} >>> + >>> >> >> I don't see how typeof would be used. As I understand the docs it can >> only set types relative to something what is already defined (and in >> some cases actually dereference/call it) and there is nothing defined >> at the point these functions are declared to copy the type from. >> > #include > #define swap(a,b) {typeof (a) mytemp ## __LINE__; mytemp ## __LINE__ =3D > b; b =3D a; a =3D mytemp ## __LINE__; } > Unlike inlines this pollutes the local namespace with unexpected identifiers.. Perhaps the temporary variable should be at least prefixed with an underscore or something. But if that is ok then perhaps the existing functions in include/grub/misc.h should be converted. There is grub_max, grub_abs and grub_div_roundup already. Thanks Michal