Prev: So, it's not just ANY compile error that can be used with SFINAE.
Next: cloning struct and derived structs with primitive type members
From: Saeed Amrollahi on 15 May 2010 05:34 On May 13, 1:21 am, cpp4ever <n2xssvv.g02gfr12...(a)ntlworld.com> wrote: > Given that many other programming languages are easier to learn/use, is > my passion for C++ a form of madness? No idea why, but I enjoy challenge > of scope resolution, templates, memory management, and all the other > things that cause newcomers to C++ such confusion. > > JB { quoted banner removed; please do it yourself. -mod } Hi Each programming language has its styles, paradigms and cultures. It applies to C++. I like C++ pretty much, not because I am mad about C++, but for the design rule: Uncompromising Elegance and Efficiency. It means for each C++ feature, there was best effort, it be both elegant and efficient. For example the class std::string is almost efficient as C-style char string, or the implementation of concrete classes like point, date, pair, ... is efficient as corresponding struct representation. See: http://www.research.att.com/~bs/ieee_interview.html For achieving the above goal C++ don't enforce to use just a style like Procedural Programming, or Object-Oriented Programming, but C++ is a general-purpose programming language with a bias toward systems programming that . is a better C (supports procedural programming) . supports programming with abstract data type (object-based programming) . supports object-oriented programming . supports generic programming See: The C++ Programming Language, 3rd edition Obviously, such language is more complex that C(paradigm 1), Ada 83(paradigm 2) Java(paradigm 2 & 3) and ML (IIRC it is Generic language). Please note, The C/C++ compatibility is one of critical factors in the success of C++, because for the efficiency, I just mentioned, C++ can be applied in any areas C is used in particular system programming. About scope resolution, C++ uses the scope a lot, but it is somehow transparent. I think we have almost similar problems in similar languages. Of course following some rules and guidelines reduces them. Templates (classes and functions), are one of the most innovative features in C++. They are the basis for Generic Programming (paradigm 4) Templates are truth of life. When we look back, we see a lot of generic containers/algorithms in Standard Library like vector, map and find, find_if and sort. In the future, we will have tuples and more containers and algorithms. for design and implementation of tuples, a new concept called Variadic templates are used. Variadic templates are somehow complex, without it, we won't have elegant/efficient tuples. I confess something, I am mainly template user, rather than designer/ implementer. Memory management is much easier these days. Unlike what you wrote, beginners don't have to do memory management a lot. For example a freshman computer/physics student can use string, vector, list, valarray rather than C-Style char string, C-Style array, doubly linked list or matrix. I confess something, Most of my problems in C++ programming was memory management. Again, there are some rules and guidelines to lessen them. In comparison with Fortran, C, Pascal, Modula-2 and Smalltalk, C++ is a BIG language, so it is harder to learn. In near future, we will have a lot of features like move semantics, lambdas, constant expressions, initializer lists, user-defined literals, variadic templates, random number generators, threads, facilities for metaprogramming, various types of smart pointers. I am pretty sure, you agree with me, It's impossible to write complex programs with sequence, condition and iteration like 50 years ago, or with classes and objects like 20 years ago. For designing modern complex software, the use of complex tools is inevitable. At end, please note, C++ isn't perfect language. be cpp4ever :) Regards, -- Saeed Amrollahi -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: DeMarcus on 15 May 2010 06:54 On 2010-05-14 01:39, Andre Kaufmann wrote: > cpp4ever wrote: >> Given that many other programming languages are easier to learn/use, is >> my passion for C++ a form of madness? No idea why, but I enjoy challenge >> of scope resolution, templates, memory management, and all the other >> things that cause newcomers to C++ such confusion. > > I don't think it's only the language that makes the difference but: > > a) Libraries (the best language doesn't help, if there isn't a good > library for standard tasks: lists, file io, graphics etc. > E.g. I couldn't develop productively in C++ if it wouldn't ship > with the STL > > b) IDE / compiler support > > c) Portability / Standardization > >> JB > > C++ has very good (standard) libraries, like the STL. > But regarding graphics / GUI the standard support could be much better, > compared to other languages. > I totally agree. I would love to see, even help if I can, a modern GUI API for C++. It should probably not be in the standard, but in the standard's sibling; Boost. I know there are several GUI libraries out there, with Qt being one of the better, but I'm just very reluctant to having a company owning the API. My idea is that with all years of experience, plus C++0x, a new GUI API could be very clean and intuitive. It's also important to emphasize that Boost does not need to provide any implementation; just the API. Then several different vendors could profit on selling full implementations, as long as I can swap out one implementation for another just changing a library file. Does my idea make sense? -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: Zeljko Vrba on 16 May 2010 08:41 On 2010-05-15, Saeed Amrollahi <amrollahi.saeed(a)gmail.com> wrote: > > Each programming language has its styles, paradigms and cultures. > It applies to C++. > I like C++ pretty much, not because I am mad about C++, but for > the design rule: Uncompromising Elegance and Efficiency. > C++ elegant?! What have you been programming in before learning C++? ;) An elegant language does not need a specification of thousand pages. IMHO. Then again, "un" of the "uncompromising" could be parsed as negating the whole phrase as in: !(elegance && efficiency), in which case I agree. C++ sacrifises too much in the name of efficiency and backward C compatibility. PS. I'm in fact surprised that the original post passed through moderation. -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: DeMarcus on 16 May 2010 08:42 On 2010-05-15 22:34, Saeed Amrollahi wrote: > On May 13, 1:21 am, cpp4ever<n2xssvv.g02gfr12...(a)ntlworld.com> wrote: >> Given that many other programming languages are easier to learn/use, is >> my passion for C++ a form of madness? No idea why, but I enjoy challenge >> of scope resolution, templates, memory management, and all the other >> things that cause newcomers to C++ such confusion. >> >> JB > > { quoted banner removed; please do it yourself. -mod } > > Hi > > Each programming language has its styles, paradigms and cultures. > It applies to C++. > I like C++ pretty much, not because I am mad about C++, but for > the design rule: Uncompromising Elegance and Efficiency. > It means for each C++ feature, there was best effort, it be both > elegant and efficient. For example the class std::string is almost > efficient as C-style char string, or the implementation of concrete > classes like point, date, pair, ... is efficient as corresponding > struct representation. > See: http://www.research.att.com/~bs/ieee_interview.html > > For achieving the above goal C++ don't enforce to use just a style > like Procedural Programming, or Object-Oriented Programming, but > C++ is a general-purpose programming language with a bias toward > systems programming that > . is a better C (supports procedural programming) > . supports programming with abstract data type (object-based > programming) > . supports object-oriented programming > . supports generic programming > See: The C++ Programming Language, 3rd edition > > Obviously, such language is more complex that C(paradigm 1), Ada > 83(paradigm 2) > Java(paradigm 2& 3) and ML (IIRC it is Generic language). > > Please note, The C/C++ compatibility is one of critical factors > in the success of C++, because for the efficiency, I just mentioned, > C++ can be applied in any areas C is used in particular system > programming. > > About scope resolution, C++ uses the scope a lot, but it is somehow > transparent. I think we have almost similar problems in similar > languages. > Of course following some rules and guidelines reduces them. > > Templates (classes and functions), are one of the most innovative > features > in C++. They are the basis for Generic Programming (paradigm 4) > Templates are truth of life. When we look back, we see a lot of > generic > containers/algorithms in Standard Library like vector, map and find, > find_if and sort. > In the future, we will have tuples and more containers and algorithms. > for design and implementation of tuples, a new concept called Variadic > templates are > used. Variadic templates are somehow complex, without it, we won't > have elegant/efficient > tuples. > I confess something, I am mainly template user, rather than designer/ > implementer. > > Memory management is much easier these days. Unlike what you wrote, > beginners > don't have to do memory management a lot. For example a freshman > computer/physics student can use string, vector, list, valarray > rather than C-Style char string, C-Style array, doubly linked list or > matrix. > I confess something, Most of my problems in C++ programming was > memory management. Again, there are some rules and guidelines > to lessen them. > > In comparison with Fortran, C, Pascal, Modula-2 and Smalltalk, > C++ is a BIG language, so it is harder to learn. > In near future, we will have a lot of features like move semantics, > lambdas, constant expressions, initializer lists, user-defined > literals, > variadic templates, random number generators, threads, > facilities for metaprogramming, various types of smart pointers. > I am pretty sure, you agree with me, It's impossible to write complex > programs with sequence, condition and iteration like 50 years ago, or > with classes and objects like 20 years ago. For designing modern > complex > software, the use of complex tools is inevitable. > At end, please note, C++ isn't perfect language. > > be cpp4ever :) > > Regards, > -- Saeed Amrollahi > > I would like to add one more thing that I find powerful with C/C++, and that is the /combination/ of C and C++. Many libraries are written in plain C for the sole purpose to let the user decide herself what objects shall look like. When a library provides its own File class for instance, most often it's not designed the way the user expected, hence a wrapper is created and the code gets less efficient and cluttered. The combination of C and C++ allows efficient and clean code. -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: pfultz2 on 16 May 2010 08:47
On May 15, 4:34 pm, Saeed Amrollahi <amrollahi.sa...(a)gmail.com> wrote: > On May 13, 1:21 am, cpp4ever <n2xssvv.g02gfr12...(a)ntlworld.com> wrote: > > > Given that many other programming languages are easier to learn/use, is > > my passion for C++ a form of madness? No idea why, but I enjoy challenge > > of scope resolution, templates, memory management, and all the other > > things that cause newcomers to C++ such confusion. > > > JB > > { quoted banner removed; please do it yourself. -mod } > > Hi > > Each programming language has its styles, paradigms and cultures. > It applies to C++. > I like C++ pretty much, not because I am mad about C++, but for > the design rule: Uncompromising Elegance and Efficiency. > It means for each C++ feature, there was best effort, it be both > elegant and efficient. For example the class std::string is almost > efficient as C-style char string, or the implementation of concrete > classes like point, date, pair, ... is efficient as corresponding > struct representation. > See: http://www.research.att.com/~bs/ieee_interview.html std::string has a lot of unnecessary copying compared to C-style strings. C-strings only copy the reference, but std::string copies the entire string(which sometimes includes heap allocation and deletion). For example, std::string s = "This string will be copied"; char const * cs = "This string will only be referenced"; std::string should have been immutable then it could reference C- strings without copying, and then have std::mutable_string for making changes. Now, a lot of implementations used to use cow to reduce these copies, but this leads to another set of problems, especially in multi- threaded environments. -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] |