Re: C# generic containers from a "C++ perspective"

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Jon Harrop" <usenet@xxxxxxxxxxxxxx> ha scritto nel messaggio
news:13u7nqbca41f80@xxxxxxxxxxxxxxxxxxxxx
Giovanni Dicanio wrote:
i.e. the C# version:

List< double >

is equivalent to C++ :

vector< double >

or instead:

vector< double * >

The former. This is one of the things that C++ screwed up and is fixed in
C#, making it much nicer to program in.

I agree with you.
And that is not the only thing done better in C# than in C++ (other things
include better string management and built-in support for Unicode strings,
reflection, etc.)

However, there are also some things that IMHO are better in C++ than C#,
like RAII and deterministic destruction.
(The garbage collector is good for memory resources, but there are also
*non*-memory resources, like files, sockets, textures... for them garbage
collector is useless, and RAII and deterministic destruction are better.)

Giovanni


.



Relevant Pages

  • Re: Destructors and exceptions
    ... cpp-style RAII is mostly unportable to other languages. ... but as this approach breaks many safe programming idioms, ... See also "Deterministic Destruction can be a Bug" for an example when DD ...
    (comp.lang.python)
  • Re: Deterministic destruction and RAII idioms in Python
    ... >> want (deterministic destruction) ... how that is better than C++-style RAII. ... as you encapsulate more resources. ... I am not criticizing Python or the proposal. ...
    (comp.lang.python)
  • Re: Deterministic destruction and RAII idioms in Python
    ... I thought by "deterministic destruction" ... counting with destruction when the last reference is released. ... PEP 343 is closer to C++-style RAII. ...
    (comp.lang.python)
  • Re: Garbage Collection
    ... Remy Lebeau (TeamB) wrote: ... C++ does not have any kind of garbage collector. ... And currently it has RAII, which I sometimes miss in Delphi. ...
    (borland.public.delphi.non-technical)