MUD-Dev
mailing list archive
[ Other Periods
| Other mailing lists
| Search
]
Date:
[ Previous
| Next
]
Thread:
[ Previous
| Next
]
Index:
[ Author
| Date
| Thread
]
[MUD-Dev] Re: Question on c++ switch optimization, and parsers i
[Jon A. Lambert, replying to Ben Greear:]
>> So, the question is: Is that efficient? Does the compiler
>> generate code that does better than a linear search down the
>> case statements? If not, I can manually hack a sort of n-ary
>> tree performance into it, but I'd wrather not if I can help it.
>Instead of the array mapping to enums, why not map to funtion pointers?
Agreed. There doesn't seem to be any reason to go to an enum. If you
need additional information besides a pointer to the handling function,
you can use a pointer to a struct containing the additional info as well
as a pointer to the handling function.
I essentially do that, although I "point to" MUD code rather than
native code.
--
Don't design inefficiency in - it'll happen in the implementation. - me
Chris Gray cg#ami-cg,GraySage.Edmonton.AB.CA
http://www.GraySage.Edmonton.AB.CA/~cg
- Thread context:
- [MUD-Dev] Re: Question on c++ switch optimization, and parsers in general., (continued)
- [MUD-Dev] Re: Question on c++ switch optimization, and parsers in general.,
Adam J. Thornton adam#phoenix,Princeton.EDU, Tue 09 Feb 1999, 04:34 GMT
- [MUD-Dev] Re: Question on c++ switch optimization, and parsers in general.,
Chris Gray cg#ami-cg,GraySage.Edmonton.AB.CA, Tue 09 Feb 1999, 03:54 GMT
- [MUD-Dev] Re: Question on c++ switch optimization, and parsers i,
Chris Gray cg#ami-cg,GraySage.Edmonton.AB.CA, Mon 08 Feb 1999, 06:11 GMT
- [MUD-Dev] Question on c++ switch optimization, and parsers in general.,
Ben Greear greear#cyberhighway,net, Mon 08 Feb 1999, 05:32 GMT
[ Other Periods
| Other mailing lists
| Search
]