C++ for Objective-C programmer [closed] - c++

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I know there are a lot of "Objective-C for the C++ programmer" information out there and it could be used the other way around. I'm just curious if there is anyone who has knowledge about a "native" "C++ for the Objective-C programmer" tutorial/book?
I'm actually looking to work in C++ in parts of a upcoming iOS project. Basically I need to do a lot of wrappers around C++ code.
(I do know that they can co-exist and that Obj-C is a subset of C, just like C++, however different reasons I would like to gain more knowledge into C++. Coming from a Obj-C background I just ask for some guidance on the matter.)

I don't know of a book for learning C++ for the Objective-C programmer. The fact that the Objective-C foundation libraries offer a lot out of the box (not to mention all the other frameworks which are part of the iOS and Mac SDKs, which is the main use-area for Objective-C) which is not covered by the C++ standard libraries might be a reason. The new C++11 standard and the boost C++ libraries go some way to bridging the gap.
There are quite a few articles which describe the main difference including this one.
The understanding of OOP you have aquired in Objective C as well as it's C subset (in your question you say "Obj-C is a subset of C", it's the opposite), will give you a big head start in learning C++, but it seems you have no alternative than to use C++ books and learn directly from them.
EDIT:
Adding the link to the SO post on good C++ books, suggested by #Bart in the comments.

Take a look at Pierre Chatelier's comparison of C++ and Objective-C.
This document is designed to act as a bridge between C++ and
Objective-C.
http://pierre.chachatelier.fr/programmation/fichiers/cpp-objc-en.pdf

Related

Are string functions like strlen, strcpy, strcat really old and bad? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I asked a question about this topic and people say that there is something wrong with my university for teaching me these ancient library. Is it really true and what should I be using instead? Sorry I am still quite new I am in the first year.
Raw C strings are responsible for a significant percentage of security flaws in real world software.
Properly handling buffers is hard, and getting it wrong is depressingly common. There is a use for low level raw memory buffer manipulation of strings, but teaching it first is questionable.
One way of teaching C++ is to teach it as C, then add on some C++ features. Another is to teach it first as C++, and then add on the C compatible sub dialect.
The criticism you are hearing is objecting to the teach C then C++ option.
Learning how to program in C is great; trying to learn both C and C++ at the same time makes you a bad C and bad C++ programmer.
When C++ was first invented, this was a reasonable way to do it. There were C experts but no C++ experts. It has been a few decades since then, and best practices in C++ are no longer that similar to best practices in C, and vice versa.
Knowing what they do is useful since you may encounter ancient code that uses them.
But no, there is no need to use them in modern C++. By modern, I mean something that is being written now or has been written during this millennium.
One of the functions you mentioned, std::strlen is fairly OK to use. Technically you dont need it, but neither is it terribly bad to use.
what should I be using instead?
Most of the time: std::string and std::string_view and their member functions.

which one between " c or c++ " should I learn for beginner for to use Arduino UNO? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I want to learn how to use Arduino, but it needs some code and there are 2 different options are c and c++. I am confusing that which one to learn "c or c++" at first (I mean for beginner)? are those both same? Actually, it's really really my first time to learn code for Arduino. also, can you tell me where can I learn from? Thank you :)
You mentioned two key words, Beginner and Arduino.
Decision on learning C++ first versus learning C first might
be a matter of opinion for the key word Beginner since many
who start with one can easily adopt for the other.
learning C++ first however has some advantages versus learning C first
for the key word Arduino which I explain.
Arduino programing is mainly targeted toward bare-metal programming, which includes dealing with many environmental options/variables which are usually known at the compiling time.
Programming methodologies which exists in C++ that address processing known factors at compiling time outnumber those of which exist in C by a large number!
Although I must add that these features rarely appear in user programming interface, if any! But still these features would be available for one to implement individually regardless of using Arduino or other bare-metal programming toolkits.
Further more multiplicity of the environmental options/variables demands a well established hierarchical ordering and management which is also more addressed in C++.
You can always try the Arduino website itself as an easy source either for learning or for tutorials/examples!
But to learn the language correctly and completely always keep an eye on authentic sources like cppreference.com and/or cplusplus.com.
Finally you can always ask/lookup your questions and seek guidance here!
Good luck!

Is C a part of the .NET framework? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I've searched the net for this, but I couldn't really find an answer. I've found this though:
https://msdn.microsoft.com/en-us/library/hh875057.aspx
It says that C++ is a part of the .NET framework, and the headline writes "C/C++", but there wasn't much about C, so I wasn't able to understand if it is or not.
C and C++ are both low level, you can always write code in C and C++ that would work with other languages. The main language for the .NET I think is C#. I don't think it's necessary for you to write C++ code for a .NET project. And if you had to, then you wouldn't need to ask this, because you would know that your question doesn't even make sense. Of course, since you don't know your question is ok.
So in a sense, c and c++ are part of everything, and you can always write code in low level languages with interfaces for higher level ones like c# with .net support. But that is quite specialized and is rarely needed.
.NET Framework is an object oriented programming framework meant to be used with languages that it provides bindings for. Since C is not an object oriented language it wouldn't make sense to use it with the framework. Microsoft does provide its own version of C++ (that is incompatible with standard C++) to be used with the .NET Framework.

Is using OOP in C++ ever a mandate for a professional C++ programmer? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
My title is rather self-explanatory. I've done research on that before asking this, and hope that I'll receive an informational response. I realize that, of course, it depends on the job, but as an enthusiast C++ programmer (along with a few other languages) I just don't like OOP. I don't like anything about it. So I'm wondering if I'll just have to get over it in order to move into a professional level of C++, or if I'll be okay without it.
You can write programs in C++ and do not use OOP, but professional programmer will have to deal with some one else's code all the time, including your coworkers, using third-party libraries etc. And most of the time OOP is used in C++. So yes, you need to know OOP very well and you will be forced to use it again and again if you stick to C++ in your career.
Most, but not all, of the difference between C and C++ is regarding OOP. Constructors, memory allocation, operator overloading, run-time library, templates -- all are designed with OOP in mind. Having using C++ and not mastering OOP would be difficult.
OOP is not that bad, you may think that OOP is all about:
class customer {
String name, phone;
void sellSomethingTo();
}
but in fact even basic parts of the language are OOP, strings, vectors, matrices, growing arrays, input/output etc.
As ptic12 mentioned, the C++ parts that make it different to C but are not OOP are namespaces, function overloading, stricter type checks, advanced variable scope and declaration.
If you're a brilliant C++ programmer but just hate OOP, you could still probably get hired depending on the job. However a professional C++ programmer should be knowledgeable in OOP and you should make an effort to learn it.

GTKmm books for complete beginner? Do I need to learn GTK+ before GTKmm? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I am familiar with C++ & OOP. I really want to develop a GUI for my program running on Linux using GTKmm. However, I could not find any good book or tutorial for GTKmm.
I have never done any GUI programming before. I did read the gtkmm tutorial on GTKmm homepage http://www.gtkmm.org/en/ but I couldn't understand the way labels, widgets, boxes, etc... were arranged and how to use those classes. I got confused right at the start of chapter 4.
Therefore, my questions are:
1. Does any one know a better GTKmm tutorial rather than the one on their homepage?
2. Does learning GTK+ first make learning GTKmm easier?
If you are focused on C++, I would stick with GTKmm and not bother with GTK+ C API for now. It's different enough and will probably just confuse you, especially if you do not have a strong C background.
Unfortunately, the 3rd-party documentation of GTKmm is a little lacking. Their tutorial book though I think is top-notch. I would cut/paste, then compile their sample programs. Examining the source is the best way to learn it. For example with Chapter 4 (Buttons), look at the example program here.
Be careful to follow the right tutorial for your version of GTK (GTK2.4 vs. GTK3.0). GTK3 (and GTKmm 3) was just released.
I would recommend to learn the C API first.
GTKmm does a lot of convenience magic that is nice to have but it also hides some details that you should understand. A lot of newbie problems are from memory management, floating and reference counting and destruction of objects.
This book is very good for beginners