[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Eliminating nested functions

From: Christian Franke
Subject: Re: Eliminating nested functions
Date: Fri, 17 Apr 2009 23:57:02 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20090403 SeaMonkey/1.1.16

Pavel Roskin wrote:
I suggest that we eliminate all nested functions.  The reasons are:

1) They make the code less readable, as they make the parent functions

2) They have problems with some popular compilers, as recent as gcc-4.0
when regparm(3) is used.

3) We failed to implement a reliable test for such problems.  We are
using regparm(1) for all compilers.

4) The existing test is one of the obstacles making it impossible to
compile without having libc for the target (x86_64->i386 would be really
nice), as we need to run the compiled test executable.

5) Non-i386 architectures define NESTED_FUNC_ATTR as an empty symbol, so
developers on such architectures don't see if they use it correctly.

6) NESTED_FUNC_ATTR tends to proliferate to the file scope functions, as
it happened with grub_pci_iterate().  It only takes one caller using a
nested function to force NESTED_FUNC_ATTR on all functions used as an
argument to the same function.

7) The grub utils may not run on some 'security hardened' platform which does not allow to enable stack execution.

Christian Franke

reply via email to

[Prev in Thread] Current Thread [Next in Thread]