• Welcome to Religious Forums, a friendly forum to discuss all religions in a friendly surrounding.

    Your voice is missing! You will need to register to get access to the following site features:
    • Reply to discussions and create your own threads.
    • Our modern chat room. No add-ons or extensions required, just login and start chatting!
    • Access to private conversations with other members.

    We hope to see you as a part of our community soon!

Is C++11 still in use? What do I make of C++20?

Ostronomos

Well-Known Member
I recently heard the latest version of C++ is known as C++20 to mark the year of its birth.

I have a huge text on C++11 and have been studying it for the last 9 months so you can imagine my surprise and frustration when I heard that a newer version was created. Albeit the C++11 version still has a standard library.

I am absolutely thrilled to announce that I have begun the chapter on arrays. They are built-in data structures that contain a fixed number of elements (hence the term "container") similar to vectors. Also, like vectors you can use them to access objects. They are compound types. Unlike vectors you cannot add elements to them (hence the term "fixed") and thus they offer better run-time performance at the cost of flexibility. Whereas vectors grow dynamically.

Arrays are default initialized by the way. Meaning their element values are automatically generated. This includes those that are value initialized. I am of course referring to the remaining elements when their dimension exceeds the number of elements.

I am hoping to use this knowledge to create an app but am having some problems with coding. I don't know the reason behind the problem of why Microsoft Visual Studios 2022 is so limited compared to the rich and diverse range of C++ statements, expressions, functions and variables that are explained in the book C++ Primer. Can anyone help me with this somewhat vast discrepancy?
 

Yerda

Veteran Member
Good luck. I've heard C language programmers are in demand.

What is the app you're trying to develop?
 

icehorse

......unaffiliated...... anti-dogmatist
Premium Member
Forgive me if I'm wrong, but the OP sounds like someone without a lot of programming experience. If that's correct, C++ is a really hard first or early language to learn. I would recommend learning something like Python or Java first. They're WAY easier, and most of what you learn programming in those languages will transfer over to C++ when and if you return to C++.

That said, if you're learning the basics of any established language like C++, later versions won't generally have a big impact on what you've learned. Later versions of languages tend to add only small tweaks.
 

Ostronomos

Well-Known Member
Forgive me if I'm wrong, but the OP sounds like someone without a lot of programming experience. If that's correct, C++ is a really hard first or early language to learn. I would recommend learning something like Python or Java first. They're WAY easier, and most of what you learn programming in those languages will transfer over to C++ when and if you return to C++.

That's correct! I do not have a lot of programming experience. I am learning from a book as I enjoy the challenge. Can you tell me why the C++ language does not transfer perfectly over to Microsoft Visual Studios 2022? Do you have this software?

That said, if you're learning the basics of any established language like C++, later versions won't generally have a big impact on what you've learned. Later versions of languages tend to add only small tweaks.

Appreciate it, thank you.
 

icehorse

......unaffiliated...... anti-dogmatist
Premium Member
That's correct! I do not have a lot of programming experience. I am learning from a book as I enjoy the challenge.

I've been in computer book publishing for 20 years as an author and editor. I can tell you that not all computer books are equally easy to learn from. Can you tell me which books you're using?

Can you tell me why the C++ language does not transfer perfectly over to Microsoft Visual Studios 2022? Do you have this software?

I'm oversimplifying a bit here but: Some languages are not-proprietary like C, C++, Python, Java, Rust, JavaScript and many others. But Micro$oft tends to favor it's proprietary versions of languages, like C#, and visual basic. My guess is that Visual Studio wants you to use Micro$soft's proprietary version of C++. There are many, many really good IDEs you can use instead of visual studio that are not proprietary.

These days I'm mostly a Java programmer, I don't have any of the Micro$oft tools.

==

Back to the OP, you absolutely need to learn about arrays. But in practice you'll almost certainly end up using more advanced data structures. I would say you should focus on Lists and Maps. There are many variations on Lists and Maps, but they are the most heavily used and useful data structures.
 

ameyAtmA

~ ~
Premium Member
I don't know the reason behind the problem of why Microsoft Visual Studios 2022 is so limited compared to the rich and diverse range of C++ statements, expressions, functions and variables that are explained in the book C++ Primer. Can anyone help me with this somewhat vast discrepancy?

Visual Studio is an Integrated Development Environment. Yes, that includes a compiler too. The compiler is not VS. VS is the shell and support for developers.
The Microsoft C Compiler is what it is. How is it limited?

Can you give examples of any ANSI standard feature that Microsoft does not implement?

What you studied as C++ 11 is ANSI standard version of C++ agreed upon by pioneer groups as specification of the language. The standard C and Standard C++ is always a superset of any implementation of the language i.e. vendor specific.
Compilers and linkers are developed and sold or distributed by vendors.

Microsoft is the leader with a giant share.
Others are Turbo C / C++, Delphi etc. which no one uses today.

Linux / Unix compilers are their vendor-specific versions -- but they mostly follow the standard.

I do not believe the Microsoft C/C++ compiler is limited. It is an implementation of the ANSI standard.
What Microsoft provides is the IDE to make life simpler and easier for the developers -- you do not have to make or build by hand, the IDE does it for you.
The IDE and other libraries of Microsoft take up a lot of memory - this is a common complaint. Why do they take up memory? Because they handle a lot more.


However, as someone already said, why is this in philosophy? Because good software works on Bramh's natural rhythm?
 
Last edited:

Ostronomos

Well-Known Member
I do not believe the Microsoft C/C++ compiler is limited. It is an implementation of the ANSI standard.
What Microsoft provides is the IDE to make life simpler and easier for the developers -- you do not have to make or build by hand, the IDE does it for you.
The IDE and other libraries of Microsoft take up a lot of memory - this is a common complaint. Why do they take up memory? Because they handle a lot more.

VS has been giving me error messages like "preprocessor variable required" and "std is not a recognized statement" despite the fact that I'm coding by the book (C++ Primer 2013). I'm doing the preprocessor variable according to expectation such as #define and #endif along with std::cout or std::cin and std::end1 etc for istream and ostream objects. But to my disappointment the compiler or IDE is not recognizing these statements and Microsoft proprietorship seems to operate according to something totally alien that uses only a small number of C++ statements, functions, variables, expressions and so on. ??? Do you use this IDE to program in C++???
 

Ostronomos

Well-Known Member
I've been in computer book publishing for 20 years as an author and editor. I can tell you that not all computer books are equally easy to learn from. Can you tell me which books you're using?



I'm oversimplifying a bit here but: Some languages are not-proprietary like C, C++, Python, Java, Rust, JavaScript and many others. But Micro$oft tends to favor it's proprietary versions of languages, like C#, and visual basic. My guess is that Visual Studio wants you to use Micro$soft's proprietary version of C++. There are many, many really good IDEs you can use instead of visual studio that are not proprietary.

These days I'm mostly a Java programmer, I don't have any of the Micro$oft tools.

==

Back to the OP, you absolutely need to learn about arrays. But in practice you'll almost certainly end up using more advanced data structures. I would say you should focus on Lists and Maps. There are many variations on Lists and Maps, but they are the most heavily used and useful data structures.

Get back to you later.
 

ameyAtmA

~ ~
Premium Member
VS has been giving me error messages like "preprocessor variable required" and "std is not a recognized statement" despite the fact that I'm coding by the book (C++ Primer 2013). I'm doing the preprocessor variable according to expectation such as #define and #endif along with std::cout or std::cin and std::end1 etc for istream and ostream objects. But to my disappointment the compiler or IDE is not recognizing these statements and Microsoft proprietorship seems to operate according to something totally alien that uses only a small number of C++ statements, functions, variables, expressions and so on. ??? Do you use this IDE to program in C++???

Your INCLUDE path is missing important folders. Pull down Project --> Properties.... see this is where the IDE makes it easier for you.

Anyhow, this is not a C++ or even a software forum. This is a religious forum. I wish you good luck.
 

ameyAtmA

~ ~
Premium Member
Anyhow, this is not a C++ or even a software forum. This is a religious forum. I wish you good luck.
I wrote this.... but now I wonder. Is it? Is this really a religious forum? Or does it simply have the name "ReligiousForums"?
When someone brings up a topic like this we immediately ask them "what does this have to do with philosophy ?"
Well, programming and genuine questions/discussions like the OP are a zillion times better as topics (even if there is no religious content) than some filthy offensive threads that keep showing up on these forums every now and then.
At least the OP is learning something that is very good and helpful.
 

Ostronomos

Well-Known Member
String_type types are common to arrays, vectors and strings (which refers to their elements as characters). The subscript operator, like the iterator, is used to access the elements and dereference operators obtain the element.
 

Ostronomos

Well-Known Member
CAN SOMEONE PLEASE EXPLAIN WHAT IS WRONG WITH THIS CODE???

#define if
#define region
#if true
using System.Numerics;
using (System)
{
Vector<string>text ;
for (auto it = text.cbegin()
auto it != text.cend(), & it->!empty(); ++iterator) ;
int end1 = 0;
; int cout = 0
cout << it << end1;
return 0; }
 

Ostronomos

Well-Known Member
To explain,

I am hoping to iterate through a text file beginning with the initial element and terminate at a null string.

I tried to do as Am asked but it is giving me error messages saying that I made syntax and operator errors.

I selected Console window under properties like you told me to.
 

Ostronomos

Well-Known Member
Can someone please assist me with the following?

In the first 117 pages of C++ Primer (C++11) there is no mention of a header called #import. And yet VS insists that I must use it. Why is that?

Also they require that you declare Standard input and output objects as "int" as in "int cout = 0", why? The book makes no mention of that.

Among other things.
 

Tinker Grey

Wanderer
Can someone please assist me with the following?

In the first 117 pages of C++ Primer (C++11) there is no mention of a header called #import. And yet VS insists that I must use it. Why is that?

Also they require that you declare Standard input and output objects as "int" as in "int cout = 0", why? The book makes no mention of that.

Among other things.
I'm betting you have VS configured to think you're working in another language.
 

ameyAtmA

~ ~
Premium Member
CAN SOMEONE PLEASE EXPLAIN WHAT IS WRONG WITH THIS CODE???

#define if
#define region
#if true

#if true then what? A hanging if. There has to be a matching #endif

Did you mean to do this ?
#ifdef region
<code section>
#else
<alternate code section>
#endif




using System.Numerics;
using (System)
{
Vector<string>text ; // should have space between type and variable name
for (auto it = text.cbegin() // missing semi-colon
auto it != text.cend(), & it->!empty(); ++iterator) ; // && not &, and no comma. You are declaring the variable 'it' again - which will give compiler errors
int end1 = 0; // did you mean endl - end of line? that is not a variable
; int cout = 0 // Why is the semicolon before the statement? cout is standard out stream, you cannot use it as a variable.
cout << it << end1;
return 0; }

#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main()
{

int i = 0;
std::vector<string> text = {
"This is line 1",
"this is line 2",
"this is line 3",
"This is line 4",
"This is line 5"
};

auto len = text.size();

//for (auto it = text.begin(); i < len && text.at(i) != "" ; it++ )
for (i = 0; i < len && text.at(i) != ""; i++)
{
cout << text.at(i) << endl;
//i++;
}
return 0;

}




Wrong code marked in red, and comments in red, correct code in green.


 
Last edited:

Ostronomos

Well-Known Member
#if true then what? A hanging if. There has to be a matching #endif

Did you mean to do this ?
#ifdef region
<code section>
#else
<alternate code section>
#endif






#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main()
{

int i = 0;
std::vector<string> text = {
"This is line 1",
"this is line 2",
"this is line 3",
"This is line 4",
"This is line 5"
};

auto len = text.size();

//for (auto it = text.begin(); i < len && text.at(i) != "" ; it++ )
for (i = 0; i < len && text.at(i) != ""; i++)
{
cout << text.at(i) << endl;
//i++;
}
return 0;

}




Wrong code marked in red, and comments in red, correct code in green.




For the most part this checks out. I don't know exactly what len is or why you printed a member function rather than an object but okay. Can you explain?
 

Brickjectivity

wind and rain touch not this brain
Staff member
Premium Member
I've been in computer book publishing for 20 years as an author and editor. I can tell you that not all computer books are equally easy to learn from. Can you tell me which books you're using?
Thanks for asking. I'm currently reading The Rust Programming Language, and boy oh boy is it the most logically laid out programming book I have ever encountered. Its as good as or better than Michael Myer's A+ book. Its concise but also doesn't skip around. If you get through the text and don't know something its because you have forgotten something.

My plan is to read through this book online, then do some exercises while referring back to the text for reference. I have reached chapter 9.

A bad programming book I encountered was DNS & Bind. (O'Reilly) I bought that book when I was a teenager, and it gave me no clue as to how to proceed. I simply wanted to understand, and it presumed that I already was some kind of network expert; but it wasn't the worst.

The worst computing book that I ever encountered? Debian linux given to me on 14 floppies in 1994. Impenetrable. I got the kernel installed, but the packaging system had a lot of weird package conflicts. Its online documentation was a horror show to an inexperienced user, and I never got GNU properly installed.

Dishonorable mention goes to any paperback book that presumed that I already understood CGI gateways.

The Turbo C++ manual only described the compiler, not the language. It was an entire book hundreds of pages long that didn't teach you nada about how to code in C++.
 
Top