Not logged in
Log in now
Create an account
Subscribe to LWN
LWN.net Weekly Edition for May 16, 2013
A look at the PyPy 2.0 release
PostgreSQL 9.3 beta: Federated databases and more
LWN.net Weekly Edition for May 9, 2013
(Nearly) full tickless operation in 3.10
What is Science?
Posted Jun 30, 2012 8:15 UTC (Sat) by HelloWorld (guest, #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 (guest, #56129)
Posted Jun 30, 2012 22:00 UTC (Sat) by Cyberax (✭ supporter ✭, #52523)
Posted Jul 1, 2012 10:17 UTC (Sun) by HelloWorld (guest, #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