Working with C++ without C [closed] - c++

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Improve this question
Conceptually, my home language is Python. I did some C during the last semester and can understand the way it works, but I do not like raw pointers, raw mallocs and the lack of classes. I do like the speed and compiling though. C++ looks really good to me.
However, when I try to write some small programs in it and look specific tasks up, I often find C code again. I was going to send a simple GET request, and somebody suggested using cURL, which is a C library. Using that would break me out of my C++ abstraction again.
Is it possible to program in C++ without having to revert to C for most tasks? To me, C++ looks like a coherent language, but not like a stand-alone ecosystem.

People often write libraries in C, in preference to C++, because of its greater interoperability. If you write a C++ library, you can only directly use it from C++. If you write a C library, you can use it from C++, C, Fortran, Python, C#, etc.
One of the major design considerations for C++ was that it interoperate with C, precisely because of the existence of this large body of libraries. The designers of C++, in other words, wanted you to be able to use C libraries. Act accordingly.

Related

C++ application with neat codebase to learn from [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I'm searching for an application written in C++ with a neat codebase, to learn from and maybe even contribute to it. A lot of applications written in C++ are either very large or doing some really advanced stuff, which is just the domain of C++.
A good candidate of size and shape would be something like pacman and libalpm from Archlinux, but it is written in plain C, not C++. WebKit is just far to big and Protobuf is looking awkward. Gnote looks to be a good starting point and I'm also using GNOME, but I wasn't sure about it because it offers a GUI. Which brings me back to pacman; I'm already using it myself and it doesn't distract with stuff like a GUI.
So I decided to look for something small and sane, which offers a CLI and which I can use myself. I opened the search of github with the terms note + c++ + stars and the result is taskwarrior. A brief look on the source of task(warrior) looks promising.
Do you know a neat project which written in C++?
Thanks

How to use Ruby in C/C++ [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I have some experience in C/C++ but I am new to Ruby. So today I got a task from my teacher to use some other languages to create a shared library (in my case, .so) that I will use in my C++ program. I wanted to try Ruby for a long time, but now when I compiled, installed and played with it a bit, I have no idea what's next.
I googled alot, but all I can find (SWIG, Rice) is related to using C/C++ in Ruby, not Ruby in C/C++. Is it possible? Am I wrong with SWIG and Rice and I actually CAN use them vice-versa (ruby for c, c for ruby)? If it is so, can you please attach any guides about that?
Ruby is an interpreted language, and I've never seen it compiled. What I know is that you can drop into C/C++ from within ruby. It's unclear what you're trying to accomplish. You might be looking for something that doesn't exist or make sense?
In Ruby, libraries are called gems, which are a collection of classes modules and other related files.
If you're looking for information about similarities between ruby and C/C++ this might be a good starting place. https://www.ruby-lang.org/en/documentation/ruby-from-other-languages/to-ruby-from-c-and-cpp/
Other than that, please do some more research and refine your question.

Where Can I find some good examples in c++ to study object oriented concepts? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I am trying to learn object oriented concepts by studying a real world example in c++.
This exmple should illustrate all concepts like inheritance, encapsulation, overloading, polymorphism etc.
Considering a quite popular post here on SO , there are lot of solutions to your problem, probably the best one is this book.
I would like to also recommend another path: pick 1 between Obj-C and Java if you can deviate a little from the original focus.
The reason why I'm suggesting this is the long time existence of Java, combined with its big popularity in both production and education, and the fact that Obj-C is somehow an object oriented language that "exposed" itself in the way this mechanisms works, there are a lot of pointers and really simple but powerful concepts that can help you understand this.
It's also possible to use Obj-C on platforms that are not MAC OS driven but you should use clang, not gcc, gcc is a little bit behind on objc support, at least this is what I experienced.
There is also the usual list of free resources with a lot of goodies that always helps .

Very easy to use 2d (optionally 3d) drawing library / wrapper for directx or opengl? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I'm studying physics and I know C++ at a basic level. at my study it's sometimes really useful to create a program which can graphicly represent some data or do calculations and then graphicly represent them. I read that, for example, to be able to master the basics of openGL I would need to do a 10 week long course of openGL. But that is too much time.
I'm wondering if there are any libraries available (for windows) which allow me to do some easy stuff like:
-DrawPixel(x,y,color)
-DrawCircle/Line/Shape/Polygon([list of points])/Triangle/Square (+rotation)
-DrawImage(filename,width,height,etc...)
-DrawText()
Is there any library which has this easyness? It would be really cool because if I do something (create a program) and I need to explain my team (who have never programmed) how I have done it (the program / results), this would make it much easier to explain!
I looked at SDL, HGE, OpenFrameworks (somewhat the "closest" yet still far away) and a few other popular libraries but they are all so far away.. why is there no such easy library?
Are there any available which are just not being found with the keywords i search in google?
I would suggest that you take a look at cinder. Try out the Hello Cinder tutorial. I think you will find it supports your needs by providing an abstraction layer above DirectX or OpenGL.

Is there any FOSS tool to reliably create a UML model from existing c++ code? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I have tried Umbrello and ArgoUML; and both are unable to generate code from an existing c++ codebase. Though they have limited capabilities in these areas, they both fail spectacularly importing a file with std, boost, SDL and local includes. Is there anything in the FOSS world that will model reasonably complex c++ code. The UML part is optional, generating coherent and accurate visualizations of the code is what matters.
Note: Tools like gprof2dot as well as doxygen can process the source, but their output is so complex as to be equivalently difficult to grasp as the original code.
Note2: Since one cannot ask about tools on SO anymore, let me rephrase the question like this:
How, given a large, old, complex and crufty c++ code base, can one quickly and efficiently perform major refactorings. By major, I mean things like:
extracting entire structs/enums/classes from an existing source/header pair into their own files
adding/deleting namespaces
changing function signatures
etc.
Some things are approachable with grep and sed; however, discovering and managing include dependencies can be overwhelming. I'm currently stuck with the "change-and-fix" method -- try refactoring something and iteratively build and fix errors as the compiler point them out. For widely used objects, this is slow. What is the proper approach?
I used Doxygen for this on a couple of projects.
It wasn't great but it was better than starting from scratch.
This paper from 2005 describes the pilfer tool, which is now included within the srctools project. It's available under a GNU General Public License.