A
aarklon
Hi all,
in the web page http://pramode-ce.livejournal.com/2006/01/18/
it is given as follows
The GNU Compiler offers an interesting extension by which you can
store the address of a label in a pointer variable.
main()
{
void *p;
p = &&L1;
goto *p;
printf("hello\n");
L1: printf("world\n");
}
The `protothread library', available from this site, uses this GCC
extension and some simple preprocessor magic to develop a very low
overhead non-preemptive multithreading system suitable for use in
severly memory constrained systems. There is also an alternate
implementation based on a clever use of the switch-case statement. The
source code is recommended reading for people interested in creative C
coding! I was able to use the code unchanged for writing a toy
non-preemptive tasking system for my ARM7 CPU
now my questions are as follows
1) Is it possible to implement such a functionality in ANSI C ??
2)what is this alternate implementation based on a clever use of the
switch-case statement.??
can anybody give examples??
in the web page http://pramode-ce.livejournal.com/2006/01/18/
it is given as follows
The GNU Compiler offers an interesting extension by which you can
store the address of a label in a pointer variable.
main()
{
void *p;
p = &&L1;
goto *p;
printf("hello\n");
L1: printf("world\n");
}
The `protothread library', available from this site, uses this GCC
extension and some simple preprocessor magic to develop a very low
overhead non-preemptive multithreading system suitable for use in
severly memory constrained systems. There is also an alternate
implementation based on a clever use of the switch-case statement. The
source code is recommended reading for people interested in creative C
coding! I was able to use the code unchanged for writing a toy
non-preemptive tasking system for my ARM7 CPU
now my questions are as follows
1) Is it possible to implement such a functionality in ANSI C ??
2)what is this alternate implementation based on a clever use of the
switch-case statement.??
can anybody give examples??