Re: C vs. C++



On Jan 12, 6:19 am, beggars.banq...@xxxxxxxxx wrote:
Hi everybody
No trolling here, but I just thought C++ was just object oriented C
but I was recently surprised to learn that C was much more used in
numerical, computational physics. So here's my question : why would C
be better for this kind of programming.


People have made arguments along the lines of using "std::vector" will
result in more bloated, slower code.

When you compare C and C++ and talk about using the C++ Standard
Library, you're not comparing the languages at all but merely
comparing the languages as they tend to be used by a lot of people.

There's nothing in the C++ Standard that says you have to use
std::vector instead of an array.

I, for one, program in C++ but I prefer procedural programming a lot
of the time. Plus I can't remember the last time I used "std::vector",
I use arrays instead.

C++ is C with more features added, and is inherently better. The
downside is that there's less compilers available. Sure, if you use
the C++ Standard Library to do stuff, you /might/ end up with less
efficient code, but you'd be surprised at how well written the C++
Standard Library tends to be.
.



Relevant Pages

  • Re: LISPPA
    ... > The abstract mathematical definition doesn't cope too well ... programming languages which do not allow to write bad programs, ... definition of array? ...
    (comp.lang.lisp)
  • Re: game design school
    ... > most popular programming language to use in game programming because ... implemented using another specific compiler on the same platform. ... you are comparing apples to oranges because you are ... despite its name compares specific implementations of languages rather ...
    (rec.games.design)
  • Re: execvp second argument question
    ... |> array is, lets say, 10, whilst the arguments are 2. ... Programmers of languages higher than ... But when programming in C, assembly, etc, for the ... If you have trouble understanding your perl code after two days, ...
    (comp.unix.programmer)
  • Re: A List of One.
    ... An array is often represented in memory as a single number that points ... If we want to retrieve the first item of the array, ... that's how arrays were implemented in many older programming ... languages, and still are in lower-level languages like C. Modern, ...
    (alt.html)
  • Re: A List of One.
    ... Javascript, for example, numbers the initial item in the images array (-and ... If we want to retrieve the first item of the array, ... that's how arrays were implemented in many older programming ... languages, and still are in lower-level languages like C. Modern, ...
    (alt.html)