[Top][All Lists]

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

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

From: David A. Wheeler
Subject: Re: [Tinycc-devel] Static variables (grischka5)
Date: Thu, 03 May 2007 00:45:50 -0400 (EDT)

Dave Dodge:
> 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) ...

I'd normally use a typedef; this would be HIDEOUS in normal code.  The only 
reason I did it this way was because I _was_ trying to abuse the compiler.  
This is a test case, and if the compiler can survive hideous test cases, I 
figure it's more likely to be correct for "normal" code too.  If you think 
having simple test cases are important feel free to simplify - that's just why 
I did it in that (unusual) way.

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

I'd forgotten about cdecl.  Shucks, what's the fun in twisty declarations if 
there's a secret decoder ring available? :-).

> > (How does anyone survive lisp?)
> Lisp is much easier because it doesn't have things like left and right
> precedence to deal with.

Yeah - it's the right-to-leftness of C type decls (normally), combined with the 
postfix left-to-rightness of the "this is a function ()" notation and the use 
of () for precedence overriding, that makes C decls funky.  Lisp has no 
precedence to override, and a single direction to parse.  Eons ago I wrote a 
lot of (Common Lisp) code, so parentheses don't scare me :-).

Anyway, back to extracting goodness...!

--- David A. Wheeler

reply via email to

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