RE: optimization question: mpl

2011-10-17 Thread Hite, Christopher
> void foo<0>(int id, DecodeContext& dc) {} int main(){ DecodeContext& dc= *(DecodeContext*)0;// junk for now int id=std::rand(); // runtime dependent foo<50>(id,dc); return 0; } -Original Message- From: Piotr Rak [mailto:piotr@gma

Re: optimization question: mpl

2010-07-29 Thread Larry Evans
On 07/28/10 10:26, Richard Guenther wrote: [snip] You can use the flatten attribute to tell the compiler to inline all calls in a given function, like void __attribute__((flatten)) foo(void) { ... decode1(); ... } and it will inline decode1() (and recursively all its callees). [snip] Will th

Re: optimization question: mpl

2010-07-28 Thread Larry Evans
On 07/28/10 13:16, Piotr Rak wrote: [snip] Or you could just initialize static array of pointers, like that (please note, that I never compiled code below): [snip] Piotr, something similar was proposed here: http://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/364c0dd5

Re: optimization question: mpl

2010-07-28 Thread Piotr Rak
Hi, 2010/7/28 Hite, Christopher : >> Generally without knowing the compiler version you are using >> it is hard to tell. > I'll use whatever's best.  Right now I'm still on 4.4.3.  I'll probably > upgrade soon to 4.5. > >> The same is true without a complete compilable testcase. > I didn't want to

Re: optimization question: mpl

2010-07-28 Thread Larry Evans
On 07/28/10 10:53, Hite, Christopher wrote: [snip] struct DecodeContext; struct M1{ static const int id=1; static void decode(DecodeContext& ){} }; struct M2{ static const int id=2; static void decode(DecodeContext& ){} }; struct M3{ static const int id=

RE: optimization question: mpl

2010-07-28 Thread Hite, Christopher
> Generally without knowing the compiler version you are using > it is hard to tell. I'll use whatever's best. Right now I'm still on 4.4.3. I'll probably upgrade soon to 4.5. > The same is true without a complete compilable testcase. I didn't want to make a test case that depends on boost::mp

Re: optimization question: mpl

2010-07-28 Thread Larry Evans
On 07/28/10 09:37, Hite, Christopher wrote: [snip] I'm tring to use the template compiler to generate equivalent code. I have a mpl::list of packet descriptions like this: struct Packet1{ static const int id=1; void decode(); }; I then use boost::

Re: optimization question: mpl

2010-07-28 Thread Richard Guenther
On Wed, Jul 28, 2010 at 4:37 PM, Hite, Christopher wrote: > > > > I'm writing a decoder using a meta programming techniques alla > boost::mpl and I'd like to know if I'm asking too much of the compiler. > > Basically I've got lots of packet types with different ids.  The > classical way to write t