L
Lilith
I was working on a routine that requires me to parse out a list of
attributes of an object in a text line. An attribute could be empty,
causing it to revert to it's current value, or the list of attributes
could terminate without completing and all unlisted attributes revert.
The structure of the program at this point looks like a string along
these lines....
set pointers
copy attribute
check for termination
if terminated, break
set pointers
copy attribute
check for termination
if terminated, break
set pointers
copy attribute
check for termination
if terminated, break
...
Unfortunately the only means I could find of skipping over the
remaining code without using a goto was to enclose it thusly....
do {
set pointers
copy attribute
check for termination
if terminated, break
set pointers
copy attribute
check for termination
if terminated, break
set pointers
copy attribute
check for termination
if terminated, break
...
} while (false);
Is this klugie? Is there a better way? I could make the whole piece
of code a function and escape out with a return but that seems just as
extraneous. I could make it a for loop and use the termination as the
exit condition but that would mean setting up a table of pointers to
read from in each loop, just as convoluted.
So, is there a better way?
attributes of an object in a text line. An attribute could be empty,
causing it to revert to it's current value, or the list of attributes
could terminate without completing and all unlisted attributes revert.
The structure of the program at this point looks like a string along
these lines....
set pointers
copy attribute
check for termination
if terminated, break
set pointers
copy attribute
check for termination
if terminated, break
set pointers
copy attribute
check for termination
if terminated, break
...
Unfortunately the only means I could find of skipping over the
remaining code without using a goto was to enclose it thusly....
do {
set pointers
copy attribute
check for termination
if terminated, break
set pointers
copy attribute
check for termination
if terminated, break
set pointers
copy attribute
check for termination
if terminated, break
...
} while (false);
Is this klugie? Is there a better way? I could make the whole piece
of code a function and escape out with a return but that seems just as
extraneous. I could make it a for loop and use the termination as the
exit condition but that would mean setting up a table of pointers to
read from in each loop, just as convoluted.
So, is there a better way?