[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | DECC |
Notice: | General DEC C discussions |
Moderator: | TLE::D_SMITH N TE |
|
Created: | Fri Nov 13 1992 |
Last Modified: | Fri Jun 06 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 2212 |
Total number of notes: | 11045 |
2085.0. "Alter goto is there one ...?" by KERNEL::PULLEY (Come! while living waters flow) Wed Feb 05 1997 12:38
Hi,
Is there something like a changeable goto?
Don't worry if there isn't, I'd just like to know.
What I'm trying to do is add some debugging functions to my program.
I didn't want to necessarily run it in debug, but just to get the
functions to execute if a variable was set--so during the program
they'd
either always run, or always not.
Now I can do something like:-
if (debug variable set)
the_debug_function();
but that tests every time which may not be necessary.
So is there a way I can:-
If (debug variable set)
thelabel=debuglabel;
else
thelabel=nodebuglabel
...
goto thelabel;
debuglabel: the_debug_function();
nodebuglabel: ...
Thanks,
Steve.
T.R | Title | User | Personal Name | Date | Lines |
---|
2085.1 | Use a function variable? | WIBBIN::NOYCE | Pulling weeds, pickin' stones | Wed Feb 05 1997 12:56 | 12 |
| How about
void ret() {};
void debugfunc() {printf("whatever...\n";)
:
void (*thefunc)();
:
If (debug variable set)
thefunc=debugfunc;
else
thefunc=ret;
:
thefunc();
|