Linked by anonymous on Tue 29th Mar 2011 16:05 UTC
General Development The C++ programming language is about to be updated, as the ISO steering committee for the language has approved the final draft specifying its next version. The ISO/IEC Information Technology Task Force will review the steering committee's Final Draft International Standard will review and, barring any complications, publish the draft later this year. It will be known as C++ 2011.
Thread beginning with comment 468278
To view parent comment, click here.
To read all comments associated with this story, please click here.
TheMonoTone
Member since:
2006-01-01

C++ tends to fill the space of high performance application that still want the syntax niceties so RSI doesn't set in for the developer team. Think any large multimedia production suite or game development kit and its almost always going to be C++ in some form or another. C++ is really different languages to different groups and individuals.

While C is ok for large programs at some point you want your inheritance and virtual functions without the cost of a hash table lookup (like in a higher level language such as python) and well, C++ adds that just-enough syntax goodies to make it worth the added pain of readability sometimes.

But most of the time I'd agree, C is overall the better easier to read language, if only humans never got RSI and man hours were infinite.

Sometimes I think too, C++ can do some clever things that would be arduous to accomplish in C (though always possible). Think the Eigen matrix library for example. Its only competitor is intel's mkl at this point, both C++ template libraries that do lots of compile time optimizations using templates, yet the syntax still looks something like using a statically typed numpy.

Its really quite an amazing library and doing the same in C would require lots of macro magic that would surely turn your code in to a very difficult pile to figure out.

Reply Parent Score: 3

vivainio Member since:
2008-12-26

But most of the time I'd agree, C is overall the better easier to read language, if only humans never got RSI and man hours were infinite.


Take a look at how OO in C looks like:

https://maemo.gitorious.org/fremantle-hildon-desktop/libhildondeskto...

Reply Parent Score: 2

rom508 Member since:
2007-04-20

Or something like this:

#include "utc_date_clock.h"
#include <stdio.h>

/*
Object inheritance hierarchy:

simple_clock (Current time)
|
+-date_clock (Current time + date)
|
+-utc_date_clock (Current date + UTC time)
*/

int main(void)
{
/* Clock object */
utc_date_clock_t uc;

/* Constructor */
utc_date_clock_init(&uc);

/* Calls simple_clock set_time() function */
utc_date_clock_set_time(&uc);

/* Calls date_clock set_date() function */
utc_date_clock_set_date(&uc);

/* Calls utc_date_clock set_utc_time() function */
utc_date_clock_set_utc_time(&uc);


/* Cast to (simple_clock_t *) object pointer */
printf("\n");
/* Calls virtual display() function */
simple_clock_display_rtb((simple_clock_t *)&uc);
/* Calls non-virtual display() function */
simple_clock_display((simple_clock_t *)&uc);


/* Cast to (date_clock_t *) object pointer */
printf("\n");
/* Calls virtual display() function */
date_clock_display_rtb((date_clock_t *)&uc);
/* Calls non-virtual display() function */
date_clock_display((date_clock_t *)&uc);


/* Cast to (utc_date_clock_t *) object pointer */
printf("\n");
/* Calls virtual display() function */
utc_date_clock_display_rtb((utc_date_clock_t *)&uc);
/* Calls non-virtual display() function */
utc_date_clock_display((utc_date_clock_t *)&uc);


printf("\n");
/* Virtual destructor */
simple_clock_free_rtb((simple_clock_t *)&uc);

return 0;
}

atom$ gcc -O -Wall simple_clock.c date_clock.c utc_date_clock.c clocks_main.c
atom$ ./a.out
simple_clock_init() returning
date_clock_init() returning
utc_date_clock_init() returning

30/03/2011 (UTC 12:37:51)
12:37:51

30/03/2011 (UTC 12:37:51)
12:37:51 30/03/2011

30/03/2011 (UTC 12:37:51)
30/03/2011 (UTC 12:37:51)

simple_clock_free() returning
date_clock_free() returning
utc_date_clock_free() returning

Reply Parent Score: 1

alexeiz Member since:
2011-03-30



Frankly, I can't see the forest for the trees in that code.

Reply Parent Score: 1