Catch up on stories from the past week (and beyond) at the Slashdot story archive


Forgot your password?
For the out-of-band Slashdot experience (mostly headlines), follow us on Twitter, or Facebook. ×

Comment: Re:What else do you need? (Score 1) 296 296

You said that it should be cross-platform, which rules out C#, IMHO

Also consider that, if you go for C++, you'll have to compile it for each platform.

Maybe you can have a C++ library that deals with memory and do the rest in a language you're more familiar with? e.g. using Boost.Python to interface with... well, Python.

There are similar solutions for Java and other high-level languages (in general I tend to avoid mixing languages but sometimes it's a necessary evil).

Comment: Re:C++ is never the right tool (Score 2) 296 296

Edit: My statement that Python in implemented in C++ may not be entirely correct (there are C implementations) but that's not the point and shouldn't prevent you from doing the exercise.

By the way, you're welcome to copy your final list on Slashdot, I'd be curious to see it for my own education.

Comment: Re:C++ is never the right tool (Score 4, Insightful) 296 296

Could you describe a project for which the choice of c++ is a good one?

Guess what, you can easily do that:

  • 1) List ALL the software you normally use (don't forget your OS and the browser you're using now)
  • 2) Cross out the software written in C++
  • 3) Cross out the software written in a language which is itself written in C++ (e.g. Python)
  • 4) Cross out the software that rely on another software/framework written in C++
  • 5) Feel free to use the remaining items on a daily basis, knowing that C++ is not undermining your life anymore

Oh... good luck!

Comment: What else do you need? (Score 5, Informative) 296 296

You said nothing useful about your project

C++ could be a good choice for all the things you've mentioned. Networking is not an issue, as there are many open source libraries (e.g. libcurl -, and using Boost is often a good thing anyway. Also, there are at least two good memory allocators: tmalloc ( and jemalloc ( so you may not need to write your own. (I assume that the above open source licenses are good for you, but they are just examples...)

However... I doubt that your project will be only Network + Memory + Disk. What else do you need? Some UI? Should it interact with the Web? Or with services in the Cloud? There's no easy answer to your question without knowing what else you need, and I wouldn't even exclude a hybrid-language approach (e.g. C++ / Python / JavaScript*).

* Before someone starts ranting about JavaScript having to run in a browser: NO - JavaScript runs perfectly fine withouth a browser, and can easily interact with C++. Have a look at V8 or SpiderMonkey, just to name some JavaScript engines.

Comment: Re:It's not about knowing, it's about understandin (Score 1) 345 345

C++ abstracts away too much for that to be useful.

Does it? :-)

I agree that C takes you very close to the bare metal. Yet C code is perfectly valid C++ code, and C++ allows you to achieve the same* level of control that you get in C, plus (as you pointed out) many useful abstractions that could hide what happens underneath.

However my point is that using some of those abstractions without understanding them could have nasty effects. Just a few examples:

  • * STD lists and vectors have very different implementations in terms of memory allocation and usage (vectors are contiguous in memory and could lead to inefficient copies if their size is not managed carefully, lists are not contiguous and tracersing them may be inefficient in some cases)
  • * shared pointers are exceptionally useful, but there's an overhead in copying them unnecessarily
  • * multiple inheritance is another powerful tool, but it's easy to misuse it if you don't understand virtual inheritance

Of course there are similar abstractions in other languages, but their implementation is often mediated by some framework/VM/etc that takes care of the shit for you to some extent. In C++ there's no garbage collector (although you can write your own) and you have full responsibility of what your code does. You can write your own tools for the job, your custom allocators, your libraries and abstractions, but you are responsible for most of it (new compilers help, thankfully).

To write good C++ you always have to see through the code, or you'll likely end up having sub-optimal stuff (which I concede can be enough in some cases).

* if you think that's not the case, please provide some examples.

Comment: Re:It's not about knowing, it's about understandin (Score 3, Informative) 345 345

so, you claim you know:
int a = 13;

In which register a is residing, supposing we are on an ARM? Or suppose we are in an 68k? Or suppose we are on an x86?

You are just an idiot!

I don't claim i know, I claim that I understand: something that you're clearly neither willing nor capable of doing, as your question and offensive language suggest.

Have a nice day!

Comment: It's not about knowing, it's about understanding (Score 5, Insightful) 345 345

Since C++ is the language of choice when you need performance (along with C and - sometimes - assembly), to write good code it's essential to understand what each line of code does to the machine (memory, registers, ...) and if/how instructions can be optimized by the compiler.

This level of awareness is generally not required to be proficient in other languages, but in my experience it's what makes the difference between newbies and pros, at least in the areas where C++ is used for a good reason.

Said that, it can be useful to understand as much as possible of any language and C++ can provide strong foundations in that sense, as this short article points out:

"May the forces of evil become confused on the way to your house." -- George Carlin