Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #5041
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: Why C++ is vastly superior to C |
| Date | 2011-05-17 09:35 +1200 |
| Message-ID | <93djkcFlpiU10@mid.individual.net> (permalink) |
| References | <iqremk$ltg$1@dont-email.me> <93dhneFlpiU7@mid.individual.net> <4dd19427$0$2855$7b1e8fa0@news.nbl.fi> |
On 05/17/11 09:16 AM, Juha Nieminen wrote: > Ian Collins<ian-news@hotmail.com> wrote: >> I normally just use RAII as the reason. Everything else else can be >> kludged in C, but not RAII. > > It's quite difficult to kludge any kind of generic data containers in C > (which is probably the reason why the standard C library does not offer > any such containers). You could achieve something similar with preprocessor > macros, but it would be quite limited, and definitely less safe (in big > part because of the lack of RAII, constructors, destructors, etc). I think you are spot on with why C lacks standard containers. But it does have a limited set of generic algorithms. > You could perhaps make some more or less generic containers for basic > types and structs which only contain basic types (but not pointers) with > preprocessor macros, but immediately when you need more resource management > than that (such as a struct that as pointers pointing to dynamically > allocated memory or other such resources) it becomes complicated. For that > same reason it's complicated to make the containers nested. (Assigning > a container object would not be the same as assigning a basic type.) If you want an idea how complicated it is, have a look at the C containers library Jacob Navia has been developing (http://code.google.com/p/ccl/). > It's so much simpler with C++ templates. Just write any amount of > nested containers you want, no problem. > > std::deque<std::list<std::vector<std::set<std::string> > > > container; I'm not saying it's not a lot easier to do generic containers or algorithms with templates. I'm saying it's impossible to do RAII in C. I've often been asked by teams I've managed or coached why they should look at using C++ rather than C and my response normally something along the lines of "what's an automatic, simple means of preventing resource leaks worth to you?" Then we get onto the other stuff! One (DSP) team was happy just to use C++ as "C with RAII (and function overloading)". -- Ian Collins
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar
Why C++ is vastly superior to C Lynn McGuire <lmc@winsim.com> - 2011-05-16 10:08 -0500
Re: Why C++ is vastly superior to C "crea" <no@invalid.com> - 2011-05-16 16:13 +0100
Re: Why C++ is vastly superior to C "Balog Pal" <pasa@lib.hu> - 2011-05-16 17:26 +0200
Re: Why C++ is vastly superior to C Rui Maciel <rui.maciel@gmail.com> - 2011-05-16 21:21 +0100
Re: Why C++ is vastly superior to C Ian Collins <ian-news@hotmail.com> - 2011-05-17 08:57 +1200
Re: Why C++ is vastly superior to C Rui Maciel <rui.maciel@gmail.com> - 2011-05-18 00:12 +0100
Re: Why C++ is vastly superior to C Krice <paulkp@mbnet.fi> - 2011-05-16 09:29 -0700
Re: Why C++ is vastly superior to C Leigh Johnston <leigh@i42.co.uk> - 2011-05-16 17:37 +0100
Re: Why C++ is vastly superior to C Öö Tiib <ootiib@hot.ee> - 2011-05-16 10:51 -0700
Re: Why C++ is vastly superior to C Keith H Duggar <duggar@alum.mit.edu> - 2011-05-17 06:12 -0700
Re: Why C++ is vastly superior to C Juha Nieminen <nospam@thanks.invalid> - 2011-05-17 14:12 +0000
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-21 00:30 -0500
Re: Why C++ is vastly superior to C Keith H Duggar <duggar@alum.mit.edu> - 2011-05-21 11:19 -0700
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-21 23:41 -0500
Re: Why C++ is vastly superior to C Paavo Helde <myfirstname@osa.pri.ee> - 2011-05-23 00:41 -0500
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-23 01:02 -0500
Re: Why C++ is vastly superior to C Keith H Duggar <duggar@alum.mit.edu> - 2011-05-23 06:10 -0700
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-24 01:01 -0500
Re: Why C++ is vastly superior to C Keith H Duggar <duggar@alum.mit.edu> - 2011-05-23 05:59 -0700
Re: Why C++ is vastly superior to C Juha Nieminen <nospam@thanks.invalid> - 2011-05-16 17:24 +0000
Re: Why C++ is vastly superior to C Lynn McGuire <lmc@winsim.com> - 2011-05-16 12:36 -0500
Re: Why C++ is vastly superior to C Krice <paulkp@mbnet.fi> - 2011-05-16 11:25 -0700
Re: Why C++ is vastly superior to C "Balog Pal" <pasa@lib.hu> - 2011-05-16 21:16 +0200
Re: Why C++ is vastly superior to C Rui Maciel <rui.maciel@gmail.com> - 2011-05-16 21:11 +0100
Re: Why C++ is vastly superior to C Krice <paulkp@mbnet.fi> - 2011-05-16 14:12 -0700
Re: Why C++ is vastly superior to C Rui Maciel <rui.maciel@gmail.com> - 2011-05-17 00:48 +0100
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-20 23:36 -0500
Re: Why C++ is vastly superior to C Rui Maciel <rui.maciel@gmail.com> - 2011-05-21 12:25 +0100
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-21 08:22 -0500
Re: Why C++ is vastly superior to C Juha Nieminen <nospam@thanks.invalid> - 2011-05-16 21:00 +0000
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-20 23:33 -0500
Re: Why C++ is vastly superior to C Nobody <nobody@nowhere.com> - 2011-05-16 18:53 +0100
Re: Why C++ is vastly superior to C Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-16 12:05 -0700
Re: Why C++ is vastly superior to C Ian Collins <ian-news@hotmail.com> - 2011-05-17 11:09 +1200
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-20 23:58 -0500
Re: Why C++ is vastly superior to C "Balog Pal" <pasa@lib.hu> - 2011-05-17 01:23 +0200
Re: Why C++ is vastly superior to C Rui Maciel <rui.maciel@gmail.com> - 2011-05-17 00:47 +0100
Re: Why C++ is vastly superior to C Juha Nieminen <nospam@thanks.invalid> - 2011-05-17 07:34 +0000
Re: Why C++ is vastly superior to C Rui Maciel <rui.maciel@gmail.com> - 2011-05-17 11:55 +0100
Re: Why C++ is vastly superior to C Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-16 16:30 -0700
Re: Why C++ is vastly superior to C Rui Maciel <rui.maciel@gmail.com> - 2011-05-17 00:46 +0100
Re: Why C++ is vastly superior to C Rui Maciel <rui.maciel@gmail.com> - 2011-05-17 01:10 +0100
Re: Why C++ is vastly superior to C Öö Tiib <ootiib@hot.ee> - 2011-05-17 11:12 -0700
Re: Why C++ is vastly superior to C Gert-Jan de Vos <gert-jan.de.vos@onsneteindhoven.nl> - 2011-05-17 14:30 -0700
Re: Why C++ is vastly superior to C Juha Nieminen <nospam@thanks.invalid> - 2011-05-18 16:37 +0000
Re: Why C++ is vastly superior to C Lynn McGuire <lmc@winsim.com> - 2011-05-18 12:04 -0500
Re: Why C++ is vastly superior to C yatremblay@bel1lin202.(none) (Yannick Tremblay) - 2011-05-20 10:11 +0000
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-21 00:21 -0500
Re: Why C++ is vastly superior to C Juha Nieminen <nospam@thanks.invalid> - 2011-05-21 08:20 +0000
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-21 08:33 -0500
Re: Why C++ is vastly superior to C yatremblay@bel1lin202.(none) (Yannick Tremblay) - 2011-05-23 13:32 +0000
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-24 00:36 -0500
Re: Why C++ is vastly superior to C yatremblay@bel1lin202.(none) (Yannick Tremblay) - 2011-05-24 12:26 +0000
Re: Why C++ is vastly superior to C Nobody <nobody@nowhere.com> - 2011-05-21 18:27 +0100
Re: Why C++ is vastly superior to C Juha Nieminen <nospam@thanks.invalid> - 2011-05-21 18:43 +0000
Re: Why C++ is vastly superior to C Dombo <dombo@disposable.invalid> - 2011-05-21 21:10 +0200
Re: Why C++ is vastly superior to C "Balog Pal" <pasa@lib.hu> - 2011-05-21 21:48 +0200
Re: Why C++ is vastly superior to C Kai-Uwe Bux <jkherciueh@gmx.net> - 2011-05-21 22:18 +0200
Re: Why C++ is vastly superior to C "Balog Pal" <pasa@lib.hu> - 2011-05-22 02:31 +0200
Re: Why C++ is vastly superior to C Kai-Uwe Bux <jkherciueh@gmx.net> - 2011-05-22 11:54 +0200
Re: Why C++ is vastly superior to C "Balog Pal" <pasa@lib.hu> - 2011-05-22 12:23 +0200
Re: Why C++ is vastly superior to C Kai-Uwe Bux <jkherciueh@gmx.net> - 2011-05-22 14:22 +0200
Re: Why C++ is vastly superior to C "Balog Pal" <pasa@lib.hu> - 2011-05-23 12:01 +0200
Re: Why C++ is vastly superior to C Dombo <dombo@disposable.invalid> - 2011-05-21 22:45 +0200
Re: Why C++ is vastly superior to C Ian Collins <ian-news@hotmail.com> - 2011-05-22 08:56 +1200
Re: Why C++ is vastly superior to C Öö Tiib <ootiib@hot.ee> - 2011-05-21 16:08 -0700
Re: Why C++ is vastly superior to C Rui Maciel <rui.maciel@gmail.com> - 2011-05-22 13:39 +0100
Re: Why C++ is vastly superior to C "Balog Pal" <pasa@lib.hu> - 2011-05-22 02:59 +0200
Re: Why C++ is vastly superior to C Rui Maciel <rui.maciel@gmail.com> - 2011-05-22 13:24 +0100
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-21 00:12 -0500
Re: Why C++ is vastly superior to C Rui Maciel <rui.maciel@gmail.com> - 2011-05-18 00:10 +0100
Re: Why C++ is vastly superior to C Öö Tiib <ootiib@hot.ee> - 2011-05-18 02:38 -0700
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-21 00:03 -0500
Re: Why C++ is vastly superior to C Rui Maciel <rui.maciel@gmail.com> - 2011-05-21 12:21 +0100
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-21 08:38 -0500
Re: Why C++ is vastly superior to C Nobody <nobody@nowhere.com> - 2011-05-17 06:37 +0100
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-21 00:28 -0500
Re: Why C++ is vastly superior to C Isaac Gouy <igouy2@yahoo.com> - 2011-05-17 08:33 -0700
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-20 23:43 -0500
Re: Why C++ is vastly superior to C Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-21 00:47 -0700
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-21 08:41 -0500
Re: Why C++ is vastly superior to C Juha Nieminen <nospam@thanks.invalid> - 2011-05-21 08:22 +0000
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-21 08:44 -0500
Re: Why C++ is vastly superior to C "Balog Pal" <pasa@lib.hu> - 2011-05-21 18:34 +0200
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-21 23:37 -0500
Re: Why C++ is vastly superior to C Juha Nieminen <nospam@thanks.invalid> - 2011-05-22 05:57 +0000
Re: Why C++ is vastly superior to C Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-22 01:22 -0700
Re: Why C++ is vastly superior to C Juha Nieminen <nospam@thanks.invalid> - 2011-05-24 15:54 +0000
Re: Why C++ is vastly superior to C Juha Nieminen <nospam@thanks.invalid> - 2011-05-24 15:58 +0000
Re: Why C++ is vastly superior to C Leigh Johnston <leigh@i42.co.uk> - 2011-05-24 17:19 +0100
Re: Why C++ is vastly superior to C Leigh Johnston <leigh@i42.co.uk> - 2011-05-25 14:09 +0100
Re: Why C++ is vastly superior to C Rui Maciel <rui.maciel@gmail.com> - 2011-05-25 15:00 +0100
Re: Why C++ is vastly superior to C gwowen <gwowen@gmail.com> - 2011-05-25 07:20 -0700
Re: Why C++ is vastly superior to C Rui Maciel <rui.maciel@gmail.com> - 2011-05-24 17:42 +0100
Re: Why C++ is vastly superior to C hanukas <jukka@liimatta.org> - 2011-05-24 23:38 -0700
Re: Why C++ is vastly superior to C Rui Maciel <rui.maciel@gmail.com> - 2011-05-25 11:15 +0100
Re: Why C++ is vastly superior to C jacob navia <jacob@spamsink.net> - 2011-05-25 13:07 +0200
Re: Why C++ is vastly superior to C gwowen <gwowen@gmail.com> - 2011-05-25 05:12 -0700
Re: Why C++ is vastly superior to C Rui Maciel <rui.maciel@gmail.com> - 2011-05-25 15:31 +0100
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-20 23:49 -0500
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-20 23:31 -0500
Re: Why C++ is vastly superior to C Juha Nieminen <nospam@thanks.invalid> - 2011-05-16 17:25 +0000
Re: Why C++ is vastly superior to C Ebenezer <woodbrian77@gmail.com> - 2011-05-16 13:01 -0700
Re: Why C++ is vastly superior to C Ian Collins <ian-news@hotmail.com> - 2011-05-17 09:02 +1200
Re: Why C++ is vastly superior to C Juha Nieminen <nospam@thanks.invalid> - 2011-05-16 21:16 +0000
Re: Why C++ is vastly superior to C Ian Collins <ian-news@hotmail.com> - 2011-05-17 09:35 +1200
Re: Why C++ is vastly superior to C Lynn McGuire <lmc@winsim.com> - 2011-05-16 17:11 -0500
Re: Why C++ is vastly superior to C William Ahern <william@wilbur.25thandClement.com> - 2011-05-16 16:09 -0700
Re: Why C++ is vastly superior to C Ian Collins <ian-news@hotmail.com> - 2011-05-17 11:37 +1200
Re: Why C++ is vastly superior to C Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-16 16:45 -0700
Re: Why C++ is vastly superior to C Juha Nieminen <nospam@thanks.invalid> - 2011-05-17 08:20 +0000
Re: Why C++ is vastly superior to C Paul Brettschneider <paul.brettschneider@yahoo.fr> - 2011-05-17 15:43 +0200
Re: Why C++ is vastly superior to C Pete Becker <pete@versatilecoding.com> - 2011-05-17 09:59 -0400
Re: Why C++ is vastly superior to C Keith H Duggar <duggar@alum.mit.edu> - 2011-05-17 07:09 -0700
Re: Why C++ is vastly superior to C Keith H Duggar <duggar@alum.mit.edu> - 2011-05-17 07:14 -0700
Re: Why C++ is vastly superior to C "Balog Pal" <pasa@lib.hu> - 2011-05-17 16:59 +0200
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-21 01:06 -0500
Re: Why C++ is vastly superior to C Paul Brettschneider <paul.brettschneider@yahoo.fr> - 2011-05-17 16:31 +0200
Re: Why C++ is vastly superior to C "Balog Pal" <pasa@lib.hu> - 2011-05-17 16:55 +0200
Re: Why C++ is vastly superior to C yatremblay@bel1lin202.(none) (Yannick Tremblay) - 2011-05-17 13:45 +0000
Re: Why C++ is vastly superior to C Juha Nieminen <nospam@thanks.invalid> - 2011-05-17 14:18 +0000
Re: Why C++ is vastly superior to C Ian Collins <ian-news@hotmail.com> - 2011-05-17 11:12 +1200
Re: Why C++ is vastly superior to C Nobody <nobody@nowhere.com> - 2011-05-17 06:46 +0100
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-21 01:14 -0500
Re: Why C++ is vastly superior to C Nobody <nobody@nowhere.com> - 2011-05-21 09:09 +0100
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-21 08:46 -0500
Re: Why C++ is vastly superior to C Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-21 01:14 -0700
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-21 08:57 -0500
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-21 23:48 -0500
Re: Why C++ is vastly superior to C Juha Nieminen <nospam@thanks.invalid> - 2011-05-21 08:25 +0000
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-21 09:08 -0500
Re: Why C++ is vastly superior to C Dombo <dombo@disposable.invalid> - 2011-05-21 18:43 +0200
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-21 23:55 -0500
Re: Why C++ is vastly superior to C Dombo <dombo@disposable.invalid> - 2011-05-22 21:58 +0200
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-22 23:10 -0500
Re: Why C++ is vastly superior to C Ian Collins <ian-news@hotmail.com> - 2011-05-23 16:14 +1200
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-22 23:38 -0500
Re: Why C++ is vastly superior to C Ian Collins <ian-news@hotmail.com> - 2011-05-23 16:41 +1200
Re: Why C++ is vastly superior to C gwowen <gwowen@gmail.com> - 2011-05-17 00:19 -0700
Re: Why C++ is vastly superior to C gwowen <gwowen@gmail.com> - 2011-05-17 07:35 -0700
Re: Why C++ is vastly superior to C Juha Nieminen <nospam@thanks.invalid> - 2011-05-17 16:13 +0000
Re: Why C++ is vastly superior to C Juha Nieminen <nospam@thanks.invalid> - 2011-05-17 08:26 +0000
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-21 01:18 -0500
Re: Why C++ is vastly superior to C Man-wai Chang <toylet.toylet@gmail.com> - 2011-05-18 15:38 +0800
Re: Why C++ is vastly superior to C Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-18 01:27 -0700
Re: Why C++ is vastly superior to C jacob navia <jacob@spamsink.net> - 2011-05-18 19:55 +0200
Re: Why C++ is vastly superior to C Miles Bader <miles@gnu.org> - 2011-05-19 13:50 +0900
Re: Why C++ is vastly superior to C Krice <paulkp@mbnet.fi> - 2011-05-20 02:46 -0700
Re: Why C++ is vastly superior to C gwowen <gwowen@gmail.com> - 2011-05-20 03:49 -0700
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-21 01:25 -0500
Re: Why C++ is vastly superior to C Rui Maciel <rui.maciel@gmail.com> - 2011-05-21 12:08 +0100
Re: Why C++ is vastly superior to C "MikeP" <mp011011@some.org> - 2011-05-21 09:19 -0500
Re: Why C++ is vastly superior to C Michael Tsang <miklcct@gmail.com> - 2011-05-19 20:26 +0800
Re: Why C++ is vastly superior to C Rui Maciel <rui.maciel@gmail.com> - 2011-05-20 13:28 +0100
Re: Why a skyscraper is vastly superior to a home jacob navia <jacob@spamsink.net> - 2011-05-23 22:18 +0200
Re: Why a skyscraper is vastly superior to a home "MikeP" <mp011011@some.org> - 2011-05-24 01:23 -0500
Re: Why a skyscraper is vastly superior to a home "MikeP" <mp011011@some.org> - 2011-05-24 01:30 -0500
Re: Why a skyscraper is vastly superior to a home gwowen <gwowen@gmail.com> - 2011-05-24 00:44 -0700
csiph-web