[Top][All Lists]

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

Re: [Tinycc-devel] Static variables (grischka5)

From: Dave Dodge
Subject: Re: [Tinycc-devel] Static variables (grischka5)
Date: Wed, 2 May 2007 17:53:32 -0400
User-agent: Mutt/1.5.12-2006-07-14

On Wed, May 02, 2007 at 06:06:48PM -0400, Rob Landley wrote:
> On Wednesday 02 May 2007 4:54 pm, David A. Wheeler wrote:
> > void ((*static_stub1(void ((*p)(void)))) (void))

> (I don't think I've ever declared a function that returns a function
> pointer before.  Or seen it declared.  So that's what it looks
> like?)

Yeah, that's pretty hardcore doing it all in one shot.  This is one of
those cases where I'd probably resort to a typedef to keep the code a
bit cleaner, especially if the function type is being used in more
than one place:

  typedef void (*voidfunc_T)(void);
  voidfunc_T static_stub1(voidfunc_T p) ...

cdecl can also help; just remember to remove most of the identifiers:

  cdecl> explain void ((*static_stub1(void ((*)(void)))) (void))
  declare static_stub1 as function (pointer to function (void)
   returning void) returning pointer to function (void) returning void

> (How does anyone survive lisp?)

Lisp is much easier because it doesn't have things like left and right
precedence to deal with.

                                                  -Dave Dodge

reply via email to

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