Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756734AbcKBS1W (ORCPT ); Wed, 2 Nov 2016 14:27:22 -0400 Received: from conssluserg-01.nifty.com ([210.131.2.80]:44210 "EHLO conssluserg-01.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756196AbcKBS1U (ORCPT ); Wed, 2 Nov 2016 14:27:20 -0400 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-01.nifty.com uA2IQvtd015949 X-Nifty-SrcIP: [209.85.161.169] MIME-Version: 1.0 In-Reply-To: <0fcf5fb3-ff4a-a003-7814-51a6ab5ad988@users.sourceforge.net> References: <72e07814-56e9-505a-d660-91ff20b6efea@users.sourceforge.net> <44402655-ef0d-1e2f-0587-f17295a08aa3@users.sourceforge.net> <0fcf5fb3-ff4a-a003-7814-51a6ab5ad988@users.sourceforge.net> From: Masahiro Yamada Date: Thu, 3 Nov 2016 03:26:56 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: scripts/basic/bin2c: Complete error handling in main() To: SF Markus Elfring Cc: Linux Kbuild mailing list , Michal Marek , LKML , kernel-janitors@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id uA2IS2B8010533 Content-Length: 1083 Lines: 47 2016-11-03 2:48 GMT+09:00 SF Markus Elfring : >> Is replacing printf("\"\n") with puts("\"") optimization? > > Is the difference relevant if an “ordinary” string is passed instead of > a format string? I think GCC does the replacement automatically unless -ffreestanding option is given. With a quick test, I got the following disassembly 0000000000400440
: 400440: 48 83 ec 08 sub $0x8,%rsp 400444: bf c4 05 40 00 mov $0x4005c4,%edi 400449: e8 c2 ff ff ff callq 400410 40044e: 31 c0 xor %eax,%eax 400450: 48 83 c4 08 add $0x8,%rsp 400454: c3 retq from the following program: int main(void) { printf("hello, world\n"); return 0; } > >> Frankly, the result of this patch seems extremely unreadable code. > > Do you care for more complete error detection and corresponding exception handling > in this source file? I like the code as is. Such error checks and magic numbers are messy. -- Best Regards Masahiro Yamada