8 ms·
Why C/C++ Is My One True Love
- octopus 13y agoThere is no C/C++ language today! You are talking about two very different languages with similar roots.
- morphar 13y agoI know they're different, but they're still close enough to use C code in your C++ projects. And for my limited knowledge of C++, it still "feels" like an extended C. I'm not claiming I know a hell of a lot about either - just that I know enough, for both to give me power and possibilities way beyond any other language :)
- octopus 13y agoSounds like you are more of a C++ = C with classes type of guy. Maybe this will interest you: http://channel9.msdn.com/Events/GoingNative/GoingNative-2012/Keynote-Bjarne-Stroustrup-Cpp11-Style http://channel9.msdn.com/Events/GoingNative/GoingNative-2012...
- morphar 13y agoDefinitely! And I know I'm missing out on a lot... ;) I don't get to use C++ enough, so I haven't been digging into the depths of what it's capable of. I mostly program for embedded computers, when I get anywhere near C or C++, so not to much incentive to go digging... :-/ I still have an old copy of "The C++ Programming Language" on my shelf - unfortunately collecting dust... Thanks for the link! I really look forward to hearing what his thoughts are on modern programming!
- pinealservo 13y agoThe core semantics of the two are kept in close correspondence as new versions of the standards come out. There are a few points where C and C++ disagree on things that they have in common, but C programs will almost always compile as C++.
- morphar 13y agoI would definitely like to learn more C++, when time allows, but as things are right now, I guess you can say, I use C++ as the easier C, regardless of how different they are underneath. Someone joked by saying, it's like using JavaScript as the easier Java... Well... I get the idea, but C can compile with C++ programs, making it much more of a subset of C++, which I can re-use. That makes it a "no cost" tool to fall back on, when C++ is not available/possible. They are very compatible tools! :)
- Roland_Y 13y agoLua ? How could you not fall in love with Lua ?
- morphar 13y agoI did! For a while at least... ;) Actually, I still like it - it just has a somewhat area of usefullnes, which is why C or C++ will always be my favorite above all other lanhuages :)
- DrTung 13y agoI also find comfort in C/C++, it's something about that closeness to the metal that does it. In most other languages (recently I've done a bit of Python) you feel like your walking in someone else's shoes. But with C/C++ it's just you and the machine.
- morphar 13y agoTotally! I read another blog post, not long ago, that describe it pretty well... He said something like: You need to know what every single line of your code does and when to clean up after yourself - in turn, you know what every single of your code does! :) That makes the code so much more robust and you are less likely to make wrong assumptions about what a function or piece of code does. I do a lot of JS at the moment - node.js and jQuery - what I hate the most, is all the wrong assumptions I have, when somebody makes a function called "clone" (this particulalry one copies the reference) or when jQuery has chained functions, that does not "inherit scope"... I wish I had the time and patience to learn assembly - but then again... C or C++ is close enough and probably way faster to get anything done in :)
- DrTung 13y agoRe. JS: "Standing on the shoulders of giants" can have its perils, when the giants exhibit a different mind set about scope or so. Re. assembly, I'm pushing 60 so I've written a lot of assembler in the days, most of it on PDP11 and AppleII. Last time I coded in assembly was 1993, so if you're not writing your own BIOS you're good without it. Funny, though. The other day I missed something from assembler, and I'm not taking about speed or lowlevel stuff. No it was the ability to switch text segments, in C++ it would be equivalent to be able, in a single .cpp file, to switch from one translation unit to another.
- morphar 13y agoRe. giants - that was very well put! :) It seems like the wealth of new languages is creating a new breed of programmers, who think it is possible to know a language, after having developed in it for 1/2 a year or so... I think that's dangerous as each language has a syntax, that is usually very easy to learn, a set of functionality and maybe some libraries, that takes some time to get used to... But then there is all the pitfalls, the bugs that you need to learn about, the need for a way to organise the code, so it doesn't become a mess... I tend see this as "getting into the mind of the creators". Re. assembly, I think the reason I would like to learn it, is to get a better understanding of "the metal" - not so much actually developing in it, unless it has to do with embedded computers. It's funny how you always seem to miss something from language x, when you are coding in language y :) So... If you are pushing 60 - what is your thoughts on all the new languages and, in my opinion, the extremely slow progress we are making, when it comes to how we "command" computers to do stuff? I think you have spend enough time creating DB connection libraries, web servers and other networking code, forking/threading models... It should be time to make use of existing code in way that makes it extremely fast to create very well-functioning programs. Basically: shouldn't it be possible to (more or less) create a set of test cases and have the system create the actual program, by combining existing blocks of code? Isn't that what we are striving to do all the time, by collecting more and more base code we re-use?
- pinealservo 13y agoI have a hard time understanding the supposed elegance of C. I know it pretty well and use it all the time, but only because it's what the platform demands. On the one hand, C has a tiny runtime that can be omitted or replaced. On the other, it doesn't have all sorts of things that would be helpful but not require runtime overhead. My biggest complaint is lack of a module system. #include is a stupid ugly hack. Second would be the way it doesn't let you portably define and work with low-level data representations in a standard way. I don't count manual bit masking and shifting for this. I would also really prefer a more advanced type system, including parametric polymorphism integrated with the module system, but not via templates.
- morphar 13y agoIt sounds like you should take a look at go, if you haven't already :) I'm not saying C is elegant. What I like about C, is that (in my *NIX/BSD world) it is THE language, that is always available and works the way I expect - even on old FreeBSD machine, that hasn't been touched for a decade. It is also the language I can use for embedded computing. In general: the more C and C++ code I have, the more systems I can create well-functioning, speedy programs for. I don't need to learn a new language's pitfalls, bugs, shortcomings, etc... I can just rely on my knowledge of C and get to know the platform I'm developing for. That said - I recognise that some languages are more suitable for a given problem than others. I currently code a lot of Node.js (which I am starting to regret - I wish I'd chosen Go), but there is no doubt, I gain a lot in terms of not having to think about net layer (too much) and the community has made a wealth of modules of varied quality (myself included). I think you could say, C is my favorite cordless drill! :) C is a tool that works very well for many cases - at least the once I come across. There is more specialized tools for many things, but I like simplicity.
- chrisq 13y agoActually, I love C and think it is very elegant=P, especially when you read its source code. But my favorite languages are Common Lisp, Ruby and Haskell. Concerning C++, I have to agree with most part of what Steve Yegge said http://bit.ly/1dUsZsv http://bit.ly/1dUsZsv, although I used it on a daily basis... The only reason I am doing it is because the legacy code of the system is written in C++.
- adnanbaloch 13y agoI think you need to try http://www.webtoolkit.eu/wt http://www.webtoolkit.eu/wt
- morphar 13y agoWow! I didn't know about Wt! It looks really interesting! Thanks for sharing. I can't wait to check it out.