Free C++ code samples [closed] - c++

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I would like to download some code samples (or even full projects) to learn from. The only place I know of is Sourceforge, but I want top-notch, flawless* code. Not to say there is anything wrong with SF but it's a toss up, and I don't want to learn from someones bad habits.
I've been through gametutorials.com and nehe.gamedev.net, but I would prefer to find something that's been done recently with best practices in mind.
*Obviously nothing is going to be perfect

Boost.

You could look at the source of web browsers like Chrome or Firefox.

Use an open source search engine like Koders

Qt is written pretty well.

Everyone's got different ideas of what's top-notch, as there are fundamental design trade-offs with no correct answer (e.g. performance, memory usage, maintainability, reusability/generality, simplicity, clarity, concision, portability...), and one programmer's idea of elegance is another's pompous over-engineering, and yet another's over-simplistic amateurism... :-/.
Boost code is good, but complicated by a different balance of concerns than most application code: generally portability, performance & memory usage, generality, elegance of usage, and minimising misusage are prioritised massively above simplicity, clarity or concision of implementation.
I think you're better off picking some code that does something you're interested in, then in your passion to change it you'll learn see the implications of the design compromises, good and bad. A smaller project where you can rearchitect the solution and experiment with alternatives is great. No substitute for experience.

Related

How to proceed to C++ application development [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
i just covered The C++ Language by B. Stroustrup and looking for some application development.
How to start for it. Means GUI, networking databases and other related stuffs.
Should i use individual libraries or use some big ones like .net or something..
please recommend me the books and other resources to begin.
Thanks.
SO is not the best place to ask such questions (try some resources for newbies), but here are some tips from my experience:
Do not start practising C++ by doing GUI, networking, databases and other enterprise stuff. Try to start with something simple and try to avoid using much frameworks (or try to understand what is happening under the hood).
If you need to learn how to make enterprise applications (forms + database), do not do it C++, as there are more suitable languages for this, e.g. Java or C#.
But it you want to master your C++ skills, try to make, for example, a simple game. And try to do as much things as possible manually. C++ is a hard language which offers infinite ways of writing bad code and you need to understand how does it work before going deep into frameworks. This will teach you how to (and how not to) design and write C++ code.
If you decide to make a game, I would suggest www.libsdl.org and www.gamedev.net (there are a lot of tutorials and other learning materials).
As for a big framework, have a look at Qt (qt-project.org).

What is Bison and why is it useful? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have been programming for a few years now and have seen the name Bison in passing, but never bothered to ask why it is or why it might be needed. How can Bison effect how I program, can it make my C/C++ code faster?
Bison is a parser generator. It takes it's input in something similar to Backus-Naur notation and outputs code to parse input according to that grammar. It lets you write a parser more easily than you would otherwise. Instead of having to do everything manually, you only have to specify the rules of your grammar and what you want to happen when it matches one of the rules.
GNU Bison is the only Bison related to programming I know of. It won't make your code faster, and it's possible that you won't ever need it in your life. However, learning some compiler theory, or even writing a simple compiler yourself, is a terrific learning experience that does affect the way you program, the way you think about computer programming, and a lot of things like that. If you enjoy formal languages and automata, you'll enjoy compiler theory; if you dislike theory in general, it's probably not for you. If you're interested, there are lots of questions about starting books on Stackoverflow.
Oh and, once in a while a programmer does need some more complicated parsing work and suchlike, and it's a huge boon to know about parser generators, instead of writing everything by hand, following a naive approach.

OS development. How to start? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am java developer. I always wanted to write my own kernel and develop an small os, I don't know what this kernel or os will look like or what they will do but I have a passion develop something useful to contribute to this vast and beautiful open source world. I want to do this but my problem is that I don't know how to start. I had studied c/c++ in my college days, now I don't remember much of these programming languages but I can brush that up to get started. I know this journey would be difficult and long but each long journey starts with a single step.
To make sure I take correct step in right direction I need help of experts on this forum to guide me to correct direction. I am not expecting spoon feeding but your thoughts on this and references to the good books and links that could help a newbie like me to get started with such programming.
Thanks
To be honest:
I don't know what this kernel or os will look like or what they will do but I have a passion develop something useful to contribute to this vast and beautiful open source world.
If your aim is to contribute to the Open Source software pool, do not attempt to write an operating system, but pick a different thing to do. There are literally hundreds of OS projects, some of them several years in the making, and the general consensus of the OS development community over at OSDev.org is that it is interesting and fun, but not necessarily productive.
If you insist, follow that link I gave; you will find information and further links there.
Edit: If you are looking for an interesting project to learn a new language with, pick something that you would want to use. There's a reason why so many people have programmed a calculator or an address management in their early days. But seriously, C++ in kernel space is so very much different from C++ in application development that they could just as well be different languages.

can command line utilities be faster than C++? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I have a project where I want to manipulate certain output files.
This can be accomplished using a combination of grep and sed and piping with |
Alternatively, I can also write a C++ program to do the same thing.
Is there a conclusive answer on which method will be faster since grep and sed should already be fairly well optimised?
From a technical standpoint, a well-written self-contained C++ program that does everything you need will be faster than using two (or more) shell commands interconnected with a pipe, simply because there will be no IPC overhead, and they can be tailor-made and optimized for your exact needs.
But unless you're writing a program that will be run 24/7 for years, you'll never notice enough gain to be worth the effort.
And the standard rules for pre-optimization apply...
If I were you, use what is already out there as these have likely been around a long time and have been tested and tried. Writing a new program yourself to do the same thing seems like a reinventing the wheel type action and is prone to error.
If you really need faster performance than you'll get with piping, you can download the source for grep and sed and tailor it to your needs in one application (be wary of licenses if you plan on distributing your code). I'd be highly surprised if you'd even notice the overhead of piping (like Flimzy mentioned), so if things are really that slow I'd start profiling your app.
It is likely that if you are a very good C/C++ programmer and spend a lot of time, that you will be able to write a program that's faster than the pipeline you're thinking of. But unless performance is so critical in this case that you absolutely must do it this way you should use the pipeline.

Examples of Design Patterns used in FOSS [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I've read a lot of good things written about design patterns but am yet to actually look at things in detail. To me, design patterns is just a fancy name for data structures and algorithms. Before I invest any time in more reading, I'd like to see some good examples of design patterns working in real life.
What good examples of design patterns can I find in well-known open source projects?
C++ preferred.
Update: I see the close votes and downvotes. These were expected. If there is an alternative post with answers to my question, please lead me to it. At least leave a reason as to why this post doesn't belong here.
It appears you did not invest enough time into design patterns to truly grasp what they are. I encourage you to read more, because design patterns are not a fancy name for data structures and algorithms; there is barely any link between algorithms and design patterns. Design patterns are "recipes" that help you organize classes and their relationships in a way that makes them easier to reuse.
As for examples, no need to look very far: the STL collection iterators are implementations of the iterator pattern.