[ros-kernel] C++

art yerkes ayerkes at speakeasy.net
Thu Mar 11 10:22:45 CET 2004


On Thu, 11 Mar 2004 14:40:38 -0000
"Andrew Greenwood" <lists at silverblade.co.uk> wrote:

> > Don't use 'std::string' in the tight areas.  Contrary to popular belief,
> > C++ actually has C in it.  Use C for mixing audio, colorspace conversion,
> > packet headers, etc.  Alternately, don't bother using C for maintaining
> > aunt betty's cake recipies.
> 
> Use C for mixing audio, colorspace conversion...???
> 
> If I had a class with a member called Mix, that has a few loops for mixing
> audio, then surely that's almost the same as just having a C routine called
> Mix() that does the same thing?

Yes, that's what I mean.  What I'm warning against is using std::algorithm
It may seem clever to write a generic sum template to use for audio mixing.
Don't do that.

Specifically, don't do any of these things with g++:
http://www.roguewave.com/support/docs/sourcepro/stdlibug/13-7.html

I've seen the code for similiar expansions, and it's really obvious that
it's a template expansion (read slow), even after optimization.

> 
> How would you write code in C++ without C?

Sarcasm, sorry.  But to carry it into lampoon, I suspect you'd do things like
this:

#include <ancient_c>

template std::c::free_function<std::c::free_function_traits,
	std::stmt_sequence<
		std::c::function_call<std::c::printf,
			std::varargs_basis1<"hello %s",std::varargs_empty> >,
		std::stmt_sequence<
			std::simple_return<0>, std::stmt_end> > > class main {};

std::entry_point<main> program_entry_point;
--
IBM had little or no expertise on Intel processors.
-- paragraph 54, SCO v IBM, second amended complaint
No matter how cynical you become, it's never enough to keep up.
-- Lily Tomlin


-- 
IBM had little or no expertise on Intel processors.
 -- paragraph 54, SCO v IBM, second amended complaint
No matter how cynical you become, it's never enough to keep up.
 -- Lily Tomlin


More information about the Ros-kernel mailing list