Not logged in
Log in now
Create an account
Subscribe to LWN
LWN.net Weekly Edition for December 5, 2013
Deadline scheduling: coming soon?
LWN.net Weekly Edition for November 27, 2013
ACPI for ARM?
LWN.net Weekly Edition for November 21, 2013
What is Science?
Posted Jun 30, 2012 8:15 UTC (Sat) by HelloWorld (subscriber, #56129)
Posted Jun 30, 2012 8:27 UTC (Sat) by Cyberax (✭ supporter ✭, #52523)
They do tend to shrink amount of lines of code quite significantly.
Posted Jun 30, 2012 8:39 UTC (Sat) by HelloWorld (subscriber, #56129)
Posted Jun 30, 2012 22:00 UTC (Sat) by Cyberax (✭ supporter ✭, #52523)
Posted Jul 1, 2012 10:17 UTC (Sun) by HelloWorld (subscriber, #56129)
Posted Jun 30, 2012 8:28 UTC (Sat) by khim (subscriber, #9252)
This depends on your design very much. If you've dreamed up nice buzzword-compliant architecture of your project with classes, delegates and other such things then usually C++ code is smaller. If you instead will think about the task on hand and remove all the useless abstractions then often the end result will be less buzzword-compliant yet much smaller.
Of course you can write similar code in C++, but it'll not be "ideomatic C++".
Posted Jun 30, 2012 8:44 UTC (Sat) by Cyberax (✭ supporter ✭, #52523)
void add_point(double x, double y, double z)
point_callback=boost::bind(&dist_summator::add_point, &sum, _1, _2, 123.0d);
(void)(void*, int, int) point_callback;
void * point_callback_ctx;
typedef struct _dist_summator_with_fixed_z_ctx
void sum_x_y(void *ctx_ptr, int x, int y)
ctx->sum+=sqrt(x*x+y*y+ctx->z*ctx->z); //Whoopsie, forgot about ints here!
point_callback = &sum_x_y;
point_callback_ctx = &ctx;
Posted Jul 1, 2012 5:50 UTC (Sun) by wahern (subscriber, #37304)
Posted Jul 1, 2012 15:16 UTC (Sun) by hummassa (subscriber, #307)
Posted Jul 9, 2012 5:27 UTC (Mon) by daniel (subscriber, #3181)
Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds