Not as big as you think. When using proper OOP, most of the uses for pointers are eliminated. They're usually only used to allocate memory on the heap, and even then they're encapsulated (or should be encapsulated) in smart pointers.
Other than that, they're mainly used to point to other objects. Even then, references are favored.
You've never had to sort anything in programming? Hell it shows up in so many places it's not even funny. Sorting by distance, sorting by size, sorting by age, sorting by so many different things. Game programming, business logic, everywhere.
What's faster, copying 40-80 bytes or copying 4-8? For one object, sure, it's negligible. For 10000, or 1000000 those little microseconds add up quickly, especially when you only get 16.6 milliseconds to do everything like in game programming. OTOH most languages do that under the hood anyway, when they don't make you take care of it yourself.
Personally I like C++. It's simple when I need it to be and capable when I need something more powerful. Yes, there are plenty of stupid little things about it I don't like but things are better with libraries like Boost.
Sorting uses pointers. If you haven't had to implement sorting algorithms in C++, then I don't think you're at liberty to convince others why it's not bad. Sorting is more than just settings up some arrays and looping through them. If you want to be efficient with C++, you will need to use pointers.
Rollback Post to RevisionRollBack
Quote from TheFieldZy »
Nobody's perfect, so neither is Hannah Montana Linux, but it's pretty great.
Quote from BC_Programming on Operating Systems »
They all suck. They just suck differently. Sort of like prostitutes.
................. Yes it does. You honestly cannot do much in C# without taking advantage of OOP, hell, the entire basis of the language and some of it's strong points are thanks to OOP. Linq for instance.
I mean more than that even, hell, C# basically shoves OOP down your throat.
All this tells me is you have never done anything more than 'hello world' in C#, hell, if that.
I mean holy crap guy, really? Like really really? You're trying to explain to us how C++ is an OOP language, and then you go on to say C# of all languages, does not support OOP?
All this tells me is you have never done anything more than 'hello world' in C#, hell, if that.
C# technically isn't a full OOP language, as it has:
Enums
Value types
Static methods
Static classes
Pretty much nitpicking, but that's what you're doing.
--------------
If you do not use OOP concepts in C++ then you're pretty much programming in C with few additions.
--------------
To get back on point, I was stating that pointers are barely used in modern C++, with a few exceptions to certain algorithms. (with proper C++ etiquette.)
No, I've used Eclipse, Code::Blocks, Dev-C++ and maybe some others. They were all equally terrible, but in their own unique ways.
I've never encountered a linker error that a quick google search or a post on a forum couldn't solve.
Like I said, linker errors are either stupid simple, or the beginning of your own personal hell. A few weeks ago I had the pleasure of trying to find the source of a linker error for a mismatched function signature. I couldn't find the problem. The function signature it was expecting was exactly right.
It turned out, the problem was with a function signature in another class entirely. I'm not even sure what the problem actually was, because the problem class wasn't even being used by the code I was working on and it didn't even inherit from the original class that the function resided in. I think it was some kind of template shenanigans. So in spite of the fact that I managed to find and fix the problem, I don't even really know why it was broken.
And that's what I'd classify as an easy linker error, because it took me less than 15 minutes to fix. And I didn't have to Google it, either (because that wouldn't have helped).
In modern C++, pointers are barely used.
Okay, that's complete nonsense. Pointers are a fundamental part of the language. You cannot use C++ effectively without them. The recommendation is to use smart pointers instead of raw pointers. Basically this amounts to garbage collection for C++. Really that's it. Pointers are still pretty much at the core of everything in C++ (polymorphism would not work without them). Not to mention that any modern codebase is going to be rife with pointers (and usually not smart pointers).
I think most of that post is just biased hate.
I've been using C++ for 13 years, I think my "biased hate" is totally justifiable.
EDIT: For the 'most vexing parse' link, isn't function declarations inside of other functions illegal? That would most likely never happen in the real world.
Did you even really read the link? If it wasn't legal C++, it wouldn't be a problem and it certainly wouldn't have its very own Wikipedia article dedicated to it.
It's a problem because the syntax for object construction looks a lot like the syntax for function definitions. So people type something that they think is just your normal everyday object construction, but because of the parsing rules of C++ it ends up being interpreted as a function definition, when then usually results in some other compiler error because you end up misusing the function you accidentally declared.
It does happen in real life. I've seen this question crop up on more than one occasion, especially with beginners. Like you, they can't imagine why that would be considered a function definition and so get totally confused when it happens.
C# technically isn't a full OOP language, as it has:
Enums
Value types
Static methods
Static classes
Pretty much nitpicking, but that's what you're doing.
Yeah, no, you don't know what you're talking about. The presence of those constructs does not ssuddenly make C# not a "full OOP language" because there is no such thing as a "full OOP language". Languages have OOP features. C# does have OOP features, so does C++. I would argue that C#'s OOP is considerably more well-developed than those in C++.
I would also like to point out that IL, the language that C# and other .NET languages are compiled into (and ultimately run by the CLR) is very much object-oriented. The idea of things being objects is very much embedded at the core of C# and the CLR. In C++ this is not the case. After you compile C++ what you're left with usually doesn't have much in the way of objects (save for RTTI). There's no such thing as a class in natively compiled code.
Rollback Post to RevisionRollBack
Never attribute to malice what can adequately be explained by incompetence.
C# technically isn't a full OOP language, as it has:
Enums
Value types
Static methods
Static classes
Pretty much nitpicking, but that's what you're doing.
I am not nitpicking when C# was designed from the ground up to be an OOP language, like Java.
None of those things disqualify it from being an OOP language, not even a little. Again, all this is showing is how little you know.
Please show where there is "nitpicking", because I honestly do not see anything of the sort.
If you do not use OOP concepts in C++ then you're pretty much programming in C with few additions.
You missed the point entirely. My point was most OOP concepts in C++ are so hacked together that I would argue they no longer qualify, given modern OOP languages.
To get back on point, I was stating that pointers are barely used in modern C++, with a few exceptions to certain algorithms. (with proper C++ etiquette.)
This makes absolutely no sense. Pointers are a staple of C++, how can you even think this?
You missed the point entirely. My point was most OOP concepts in C++ are so hacked together that I would argue they no longer qualify, given modern OOP languages.
How so?
This makes absolutely no sense. Pointers are a staple of C++, how can you even think this?
Pointers are used as little as possible. Given that I've spent a couple years within a c++ community (cplusplus.com), I'd know. Why not open up a thread and ask them to verify if I'm correct?
Pointers are used, but they're not used as often as you guys are implying. With my current project I use pointers, but only when I HAVE to. They have their time and their place. Look at a project in (modern) C++, and look at a C equivalent. You'll see what I'm saying.
Like I said, linker errors are either stupid simple, or the beginning of your own personal hell. A few weeks ago I had the pleasure of trying to find the source of a linker error for a mismatched function signature. I couldn't find the problem. The function signature it was expecting was exactly right.
No, I've used Eclipse, Code::Blocks, Dev-C++ and maybe some others. They were all equally terrible, but in their own unique ways.
I fail to understand how that's a language issue.
I am not nitpicking when C# was designed from the ground up to be an OOP language, like Java.
Huh?
(I think I should point out that I meant 'pure' instead of full)
If you are seriously asking this, I have to severely question your experience with C++.
Even with my very limited exposure to working with the language, the problems were pretty obvious, especially coming from a C#/Python background.
Pointers are used as little as possible.
Wrong. They are a staple of the language.
Given that I've spent a couple years within a c++ community (cplusplus.com), I'd know. Why not open up a thread and ask them to verify if I'm correct?
That's great, you spent a couple years with a community.
.......So what? Asking us to open a thread there why? What if the entire community is completely wrong? How many of them have actually worked on large projects? Going off what you are saying either you are wrong, or that entire community is literally the blind leading the blind.
You're basically asking us "go to this place where I am always told I am right even when I am wrong, and put your statements there.".
Pointers are used, but they're not used as often as you guys are implying.
Again, outside of myself the others you are talking to are professionals. I think their word and experience has quite a bit more merit than yours, especially with some of the bafflingly incorrect statements you are outputting.
With my current project I use pointers, but only when I HAVE to. They have their time and their place. Look at a project in (modern) C++, and look at a C equivalent. You'll see what I'm saying.
Throw some examples, then, because I'm checking a few large, modern projects I have bookmarked on git and pointers are used quite a bit. One is a game engine, another is a MIDI input controller/receiver and the other is a memory/hex editor.
Huh?
(I think I should point out that I meant 'pure' instead of full)
What do you even mean by that?
And what do you mean "huh"? I didn't state anything that warranted a "huh" unless you really have not even a remote clue about the C# language.
Again, outside of myself the others you are talking to are professionals. I think their word and experience has quite a bit more merit than yours, especially with some of the bafflingly incorrect statements you are outputting.
I'm aware. I'm also aware there are professionals on that website.
What do you even mean by that?
And what do you mean "huh"? I didn't state anything that warranted a "huh" unless you really have not even a remote clue about the C# language.
In which case, you should get to reading:
The reason why I've replied 'huh' was because I don't understand the quoted sentence. Can you rephrase it?
Throw some examples, then, because I'm checking a few large, modern projects I have bookmarked on git and pointers are used quite a bit. One is a game engine, another is a MIDI input controller/receiver and the other is a memory/hex editor.
Pointers are used in C++. Many people I've spoken to (who really don't have much experience with the language) assume that pointers are something you'd use as- let's say an 'flow-control' statement, which is pretty wrong. Of course pointers are used in the language, but they aren't used for everything. (Not as much as they would in a language like C, with no concept of OOP whatsoever).
This probably depends on what we mean by 'a little bit' however:
Of course there are a few things in these examples that I would have done differently; some places they use pointers when they didn't really need to, but I guess that should be enough.
Even with my very limited exposure to working with the language, the problems were pretty obvious, especially coming from a C#/Python background.
Actually I'll admit my defeat here. After thinking back on switching from Ruby to C++ I can see how you can see that.
The reason why I've replied 'huh' was because I don't understand the quoted sentence. Can you rephrase it?
All he said was that C# was created to be an OO language, much like Java.
Pointers are used in C++. Many people I've spoken to (who really don't have much experience with the language) assume that pointers are something you'd use as- let's say an 'flow-control' statement, which is pretty wrong. Of course pointers are used in the language, but they aren't used for everything. (Not as much as they would in a language like C, with no concept of OOP whatsoever).
What are you trying to say here? That other people don't understand what pointers are used for? Of course they wouldn't know if they never studied them.
All of those are anecdotal in the extreme. Your experience is anecdotal and very limited as well. Your experience (self admittedly) is in small game development. Even those projects you listed were for games, and I can even pick out quite a few examples as to things that should have been done differently as far as program design is concerned. Game development is far different for any other area of development.
What are you trying to say here? That other people don't understand what pointers are used for? Of course they wouldn't know if they never studied them.
No, what I'm trying to say is that people who really never used the language at all like to automatically assume that pointers are basically everything in the language, and that's not true.
Of course I'm not putting anyone here in the category.
Even those projects you listed were for games, and I can even pick out quite a few examples as to things that should have been done differently as far as program design is concerned.
I pretty much stated that in that post.
Game development is far different for any other area of development.
Well I already stated that I was talking only about Game Development, and that I'm pretty ignorant when it comes to other areas. (Several posts ago)
So basically everything I say here isn't for any fields other than game dev.
All he said was that C# was created to be an OO language, much like Java.
No he said something about nitpicking C#. I started looking for where he did, but now I'm coming the the conclusion it was a misinterpretation on my end.
Linker errors are a language issue because pretty much any implementation of a build system for C++ will have them. It's something that you will encounter in the process of using C++, ergo, it's an issue with using the language.
My point about IDEs was simply to refute your claim that my opinions were based only on one IDE. They weren't. For that matter, IDEs are also a language use issue because they are the tools you will be using to develop software in that language.
And text editors are not a reasonable alternative to an IDE. You may be the John Henry of writing code, but as I recall that folk tale ended with him working himself to death.
Rollback Post to RevisionRollBack
Never attribute to malice what can adequately be explained by incompetence.
This is technically off-topic, but I think it's more reasonable to post in an existing thread than make another.
I'm currently learning python, and was wondering if anyone could maybe offer me any aid when it comes to developing scripts. Generally it's always one little detail that's keeping my code from functioning properly, and googling around or pestering r/learnpython isn't always successful or preferable. A general example I ran into recently was having the script only accept a rational number (float); having it return a "Please input a number" message or moving on to the next stage of the script.
This is technically off-topic, but I think it's more reasonable to post in an existing thread than make another.
I'm currently learning python, and was wondering if anyone could maybe offer me any aid when it comes to developing scripts. Generally it's always one little detail that's keeping my code from functioning properly, and googling around or pestering r/learnpython isn't always successful or preferable. A general example I ran into recently was having the script only accept a rational number (float); having it return a "Please input a number" message or moving on to the next stage of the script.
Get an Introduction to Python book and run through that. It should give you a basic understanding of the language (specifically for the example you mentioned, the intro book should cover Exceptions)
Get an Introduction to Python book and run through that. It should give you a basic understanding of the language (specifically for the example you mentioned, the intro book should cover Exceptions)
In my experience, if an intro book does not cover exceptions, along with the other basics, it's a crappy intro book.
These three are quite good, the first few chapters require no experience with anything at all, and are very user friendly. If you don't get it by that point 2 of them (the 1st and 3rd one I think) also have review sections:
Other than that, they're mainly used to point to other objects. Even then, references are favored.
EDIT: lolwut
What's faster, copying 40-80 bytes or copying 4-8? For one object, sure, it's negligible. For 10000, or 1000000 those little microseconds add up quickly, especially when you only get 16.6 milliseconds to do everything like in game programming. OTOH most languages do that under the hood anyway, when they don't make you take care of it yourself.
Personally I like C++. It's simple when I need it to be and capable when I need something more powerful. Yes, there are plenty of stupid little things about it I don't like but things are better with libraries like Boost.
C++ does not have proper OOP. At all. Flat out. Not even remotely.
That's one of the few applications where you'd actually use pointers.
@fm87 neither does C#. I meant using OOP concepts.
I mean more than that even, hell, C# basically shoves OOP down your throat.
All this tells me is you have never done anything more than 'hello world' in C#, hell, if that.
I mean holy crap guy, really? Like really really? You're trying to explain to us how C++ is an OOP language, and then you go on to say C# of all languages, does not support OOP?
I don't even......
Just..... what........
wat
C++ supports OOP design through a very, very hacky way.
"Programmers never repeat themselves. They loop."
Enums
Value types
Static methods
Static classes
Pretty much nitpicking, but that's what you're doing.
--------------
If you do not use OOP concepts in C++ then you're pretty much programming in C with few additions.
--------------
To get back on point, I was stating that pointers are barely used in modern C++, with a few exceptions to certain algorithms. (with proper C++ etiquette.)
No, I've used Eclipse, Code::Blocks, Dev-C++ and maybe some others. They were all equally terrible, but in their own unique ways.
Like I said, linker errors are either stupid simple, or the beginning of your own personal hell. A few weeks ago I had the pleasure of trying to find the source of a linker error for a mismatched function signature. I couldn't find the problem. The function signature it was expecting was exactly right.
It turned out, the problem was with a function signature in another class entirely. I'm not even sure what the problem actually was, because the problem class wasn't even being used by the code I was working on and it didn't even inherit from the original class that the function resided in. I think it was some kind of template shenanigans. So in spite of the fact that I managed to find and fix the problem, I don't even really know why it was broken.
And that's what I'd classify as an easy linker error, because it took me less than 15 minutes to fix. And I didn't have to Google it, either (because that wouldn't have helped).
Okay, that's complete nonsense. Pointers are a fundamental part of the language. You cannot use C++ effectively without them. The recommendation is to use smart pointers instead of raw pointers. Basically this amounts to garbage collection for C++. Really that's it. Pointers are still pretty much at the core of everything in C++ (polymorphism would not work without them). Not to mention that any modern codebase is going to be rife with pointers (and usually not smart pointers).
I've been using C++ for 13 years, I think my "biased hate" is totally justifiable.
Did you even really read the link? If it wasn't legal C++, it wouldn't be a problem and it certainly wouldn't have its very own Wikipedia article dedicated to it.
It's a problem because the syntax for object construction looks a lot like the syntax for function definitions. So people type something that they think is just your normal everyday object construction, but because of the parsing rules of C++ it ends up being interpreted as a function definition, when then usually results in some other compiler error because you end up misusing the function you accidentally declared.
It does happen in real life. I've seen this question crop up on more than one occasion, especially with beginners. Like you, they can't imagine why that would be considered a function definition and so get totally confused when it happens.
Yeah, no, you don't know what you're talking about. The presence of those constructs does not ssuddenly make C# not a "full OOP language" because there is no such thing as a "full OOP language". Languages have OOP features. C# does have OOP features, so does C++. I would argue that C#'s OOP is considerably more well-developed than those in C++.
I would also like to point out that IL, the language that C# and other .NET languages are compiled into (and ultimately run by the CLR) is very much object-oriented. The idea of things being objects is very much embedded at the core of C# and the CLR. In C++ this is not the case. After you compile C++ what you're left with usually doesn't have much in the way of objects (save for RTTI). There's no such thing as a class in natively compiled code.
None of those things disqualify it from being an OOP language, not even a little. Again, all this is showing is how little you know.
Please show where there is "nitpicking", because I honestly do not see anything of the sort.
You missed the point entirely. My point was most OOP concepts in C++ are so hacked together that I would argue they no longer qualify, given modern OOP languages.
This makes absolutely no sense. Pointers are a staple of C++, how can you even think this?
Pointers are used as little as possible. Given that I've spent a couple years within a c++ community (cplusplus.com), I'd know. Why not open up a thread and ask them to verify if I'm correct?
Pointers are used, but they're not used as often as you guys are implying. With my current project I use pointers, but only when I HAVE to. They have their time and their place. Look at a project in (modern) C++, and look at a C equivalent. You'll see what I'm saying.
I fail to understand how that's a language issue.
Huh?
(I think I should point out that I meant 'pure' instead of full)
Even with my very limited exposure to working with the language, the problems were pretty obvious, especially coming from a C#/Python background.
Wrong. They are a staple of the language.
That's great, you spent a couple years with a community.
.......So what? Asking us to open a thread there why? What if the entire community is completely wrong? How many of them have actually worked on large projects? Going off what you are saying either you are wrong, or that entire community is literally the blind leading the blind.
You're basically asking us "go to this place where I am always told I am right even when I am wrong, and put your statements there.".
Again, outside of myself the others you are talking to are professionals. I think their word and experience has quite a bit more merit than yours, especially with some of the bafflingly incorrect statements you are outputting.
Throw some examples, then, because I'm checking a few large, modern projects I have bookmarked on git and pointers are used quite a bit. One is a game engine, another is a MIDI input controller/receiver and the other is a memory/hex editor.
What do you even mean by that?
And what do you mean "huh"? I didn't state anything that warranted a "huh" unless you really have not even a remote clue about the C# language.
In which case, you should get to reading:
https://en.wikipedia...mming_language)
The reason why I've replied 'huh' was because I don't understand the quoted sentence. Can you rephrase it?
Pointers are used in C++. Many people I've spoken to (who really don't have much experience with the language) assume that pointers are something you'd use as- let's say an 'flow-control' statement, which is pretty wrong. Of course pointers are used in the language, but they aren't used for everything. (Not as much as they would in a language like C, with no concept of OOP whatsoever).
This probably depends on what we mean by 'a little bit' however:
https://github.com/christopho/solarus
https://github.com/BenConstable/Sangwin-Game-Engine/tree/master/src
https://github.com/joelverhagen/Gaza-2D-Game-Engine/blob/master/SetGame/CardFrameSheetGenerator.cpp
Of course there are a few things in these examples that I would have done differently; some places they use pointers when they didn't really need to, but I guess that should be enough.
Actually I'll admit my defeat here. After thinking back on switching from Ruby to C++ I can see how you can see that.
All he said was that C# was created to be an OO language, much like Java.
What are you trying to say here? That other people don't understand what pointers are used for? Of course they wouldn't know if they never studied them.
All of those are anecdotal in the extreme. Your experience is anecdotal and very limited as well. Your experience (self admittedly) is in small game development. Even those projects you listed were for games, and I can even pick out quite a few examples as to things that should have been done differently as far as program design is concerned. Game development is far different for any other area of development.
"Programmers never repeat themselves. They loop."
Of course I'm not putting anyone here in the category.
I pretty much stated that in that post.
Well I already stated that I was talking only about Game Development, and that I'm pretty ignorant when it comes to other areas. (Several posts ago)
So basically everything I say here isn't for any fields other than game dev.
No he said something about nitpicking C#. I started looking for where he did, but now I'm coming the the conclusion it was a misinterpretation on my end.
Linker errors are a language issue because pretty much any implementation of a build system for C++ will have them. It's something that you will encounter in the process of using C++, ergo, it's an issue with using the language.
My point about IDEs was simply to refute your claim that my opinions were based only on one IDE. They weren't. For that matter, IDEs are also a language use issue because they are the tools you will be using to develop software in that language.
And text editors are not a reasonable alternative to an IDE. You may be the John Henry of writing code, but as I recall that folk tale ended with him working himself to death.
I'm currently learning python, and was wondering if anyone could maybe offer me any aid when it comes to developing scripts. Generally it's always one little detail that's keeping my code from functioning properly, and googling around or pestering r/learnpython isn't always successful or preferable. A general example I ran into recently was having the script only accept a rational number (float); having it return a "Please input a number" message or moving on to the next stage of the script.
Get an Introduction to Python book and run through that. It should give you a basic understanding of the language (specifically for the example you mentioned, the intro book should cover Exceptions)
These three are quite good, the first few chapters require no experience with anything at all, and are very user friendly. If you don't get it by that point 2 of them (the 1st and 3rd one I think) also have review sections:
http://www.amazon.com/Python-Programming-Introduction-Computer-Science/dp/1590282418/ref=sr_1_4?s=books&ie=UTF8&qid=1391269161&sr=1-4&keywords=python
http://www.amazon.com/Python-3-Object-Oriented-Programming/dp/1849511268/ref=sr_1_6?s=books&ie=UTF8&qid=1391269161&sr=1-6&keywords=python
http://www.amazon.com/Python-Beginners-Mr-Alex-Bowers/dp/0988842971/ref=sr_1_11?s=books&ie=UTF8&qid=1391269161&sr=1-11&keywords=python