still computed goto

Feb 05, 2010 14:18

and this is what a generic way of making default case in my previous post

Viral, nice way of using default case.. i think u can make it more generic by using
#define DISPATCH() \
{goto *op_table[*s-'a'< sizeof(op_table)&& *s-'a'>= 0 ? *((s)++) - 'a' : (*s
- *((s)++)) + sizeof(op_table)]; }

Leave a comment

Comments 2

kathiawadi February 6 2010, 06:34:39 UTC
dont u think that you will lose the advantage of not doing condition checking by adding this code!!! the whole purpose behind optimizing switch was to remove condition checking, right???

Reply

rareisme February 11 2010, 08:12:07 UTC
hmmm ....looks like... overhead
well,
the purpose was to remove if..else...if...
less jumping/branching

Reply


Leave a comment

Up