Questions about trampolines
Clifford Wolf
clifford@clifford.at
Mon Mar 14 13:58:00 GMT 2005
Hi,
On Mon, Mar 14, 2005 at 02:11:51PM +0100, Marc Espie wrote:
> In article <4234D2CB.1010703@adacore.com> you write:
> >Well as I said above, trampolines or an equivalent are currently critically
> >needed by some front ends (and of course by anyone using the (very useful IMO)
> >extension of nested functions in C).
>
> This is your opinion, but I've yet to find an actual piece of code in a
> real project that uses that extension.
http://svn.clifford.at/spl/trunk/modules/mod_xml.c
.. much easier this way as by passing everything with the userdata pointer.
I've also seen already APIs with callbacks which do not support userdata
pointers. While I am agree that those APIs are broken it is still a good
feeling to know that it is possible to work around this issues using nested
functions...
yours,
- clifford
--
bash -c "gcc -o mysdldemo -Wall -O2 -lSDL -lm -pthread -x c <( echo -e '
#include <SDL/SDL.h>\n#include <complex.h>\nint main(){SDL_Surface*s;SDL_Event
e;int x,y,n;SDL_Init(SDL_INIT_VIDEO);s=SDL_SetVideoMode(640,480,32,0);for(x=0;
x<640;x++)for(y=0;y<480;y++){float _Complex z=0, c=((x-400)/200.0) + ((y-240)/
200.0)*1.0fi;for(n=1;n<64;n++){z=z*z+c;if(cabsf(z)>2){((Uint32*)s->pixels)[x+y
*640]=n<<3;n=99;}}}SDL_UpdateRect(s,0,0,s->w,s->h);do SDL_WaitEvent(&e); while
(e.type!=SDL_QUIT&&e.type!=SDL_KEYDOWN);SDL_Quit();return 0;}' ); ./mysdldemo"
Programming graphics in X is like finding sqrt(pi) using Roman numerals.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20050314/89cfdce9/attachment.sig>
More information about the Gcc
mailing list