Hi,
Right, we can wrap the local variables in void* and pass them in a
custom pointer, but I still think it's advantageous to put them in a
structure rather than use multiple parameters:
1, We can still use nested function. Sometimes it may seem tedious to
use external function for simple callbac
In my opinion a far better way would be to add an additional void * argument
which is passed unchanged to the hook. Like:
struct local
{
...
};
main_func ()
{
struct local locvars;
grub_*_iterate (arg1,arg2,arg3, &locvars);
}
hook (arg1, arg2, arg3, voidparg)
{
struct local *locvars = (struc
Quoting Bean :
Yeah, I agree with you. The conversion will take some effort, but it
could payoff in the long run. Perhaps we can achieve this in two
steps:
1, Change nested function definition to accept only one parameter. For
function with multiple parameters, place them in a structure and pas
Hi,
Yeah, I agree with you. The conversion will take some effort, but it
could payoff in the long run. Perhaps we can achieve this in two
steps:
1, Change nested function definition to accept only one parameter. For
function with multiple parameters, place them in a structure and pass
the pointer
From: Colin D Bennett
Date: Sat, 18 Apr 2009 08:57:33 -0700
> Probably passing a pointer to a local structure is the easiest way
> to do it in most cases if the iteration function needs to access
> some state, right?
Right.
The biggest surprise for me, easily, when reading the grub2 sources
for
David Miller wrote on Friday 17 April 2009:
> From: Pavel Roskin
> Date: Fri, 17 Apr 2009 11:54:57 -0400
>
> > I suggest that we eliminate all nested functions.
>
> I support this completely.
Me too.
While I like the idea of nested functions, since they are like closures and
make a lot of commo
From: Pavel Roskin
Date: Fri, 17 Apr 2009 11:54:57 -0400
> I suggest that we eliminate all nested functions.
I support this completely.
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel
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
longer.
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 re
On Sat, 2009-04-18 at 03:33 +0800, Bean wrote:
> Hi,
>
> One of the advantage of nested function is to use local variables.
> Without it, we would need to pass them as global variable, or add
> custom data pointer in many of the iterate function, which would make
> the code a lot uglier IMO.
Ind
On Fri, Apr 17, 2009 at 9:33 PM, Bean wrote:
> Hi,
>
> One of the advantage of nested function is to use local variables.
> Without it, we would need to pass them as global variable, or add
> custom data pointer in many of the iterate function, which would make
> the code a lot uglier IMO.
>
Do y
Hi,
One of the advantage of nested function is to use local variables.
Without it, we would need to pass them as global variable, or add
custom data pointer in many of the iterate function, which would make
the code a lot uglier IMO.
On Fri, Apr 17, 2009 at 11:54 PM, Pavel Roskin wrote:
> Hello!
11 matches
Mail list logo