Our server costs ~$56 per month to run. Please consider donating or becoming a Patron to help keep the site running. Help us gain new members by following us on Twitter and liking our page on Facebook!
Current time: December 26, 2024, 11:05 am

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hello everyone
#24
RE: Hello everyone
(April 10, 2010 at 12:45 am)Tiberius Wrote: Yes, to do other things you'd have to write methods, but this is to make things consistent. Instead of someone having to read through the documentation of what *, +, /, and - all do in your class, there are methods with *helpful names* that tell you what they do.

(April 10, 2010 at 12:45 am)Tiberius Wrote: Are you honestly saying that given an object you've never worked with before, you'd prefer to see a load of operators which you instinctively think mean "multiply" then "add" yet do completely different things over a method call that was named after the operation it actually does?
First of all, I would read the documentation on the object. Second of all, what makes you assume the operation being done is something completely different? As I said, almost all operator overloads are done in an equivalent way. For example, an iterator will overload the "++" operator. That operator increments the current list node element. Nobody in their right mind is going to overload the "++" operator and make it free every resource allocated by the class. There is a relevance between the operator being used and the operation it performs - you really need to keep that in mind. Just like the "==" for the string class will check if two strings are equivalent, it isn't going to append something to your string. The dereference operator (*) for the iterator class returns a reference to the node's object, it doesn't delete the node.

What you are saying about operators is equivalent to me saying that people can label methods with names such as "add" but really do something slightly different such as incrementing a value by 2 or something completely different, like deleting itself.

(April 10, 2010 at 12:45 am)Tiberius Wrote: It's honestly like me giving you the following sentence:

Hello( my name is Adrian& I like to program@

You say to me "That sentence is full of weird symbols", and I reply "No, I've just replaced the function of a comma with a (, a full stop with a &, and an exclamation mark with a @".
Again, you are implying that people assign random operations to random operators. There is almost always a relevance between the operator being overloaded and the operation it performs. People don't just pick random operators to overload, that does nobody any good.

(April 10, 2010 at 12:45 am)Tiberius Wrote: It's the "almost" that scares me. You say "why would they?" yet you've just said that doing so is the great thing about C++. Why would they? Because in C++ you can...and it's apparently a great thing to do.
I was implying that the great thing about C++ was it's versatility. The option for the user to implement the operators however they wish, not that people giving random operations to random operators is a beautiful thing. It is just like the issue with pointers. People say C++ is bad because it gives users access to pointers, which can have dangerous consequences.

(April 10, 2010 at 12:45 am)Tiberius Wrote: That ain't beauty...it's a travesty. How on earth do you read C++ code??? It must be a constant switch between the reference manuals and the code snippets.
It's common (programmer) sense, really. (and I don't mean that offensively)

(April 10, 2010 at 12:45 am)Tiberius Wrote: You are once again ignoring consistency. It's all very well an good having == meaning comparing values, but some classes do not have specific values to compare.
Then they shouldn't overload the == operator, simple as that.

(April 10, 2010 at 12:45 am)Tiberius Wrote: Not all classes are as simple as Points, where to work out if you have the same points, you just need to compare X and Y.
Of course not. Then they don't need to implement the == operator. As I've stated before, if you are working with pointers in C++, the == operator, the + operator, the - operator, etc. all do the same thing regardless of the type being worked with. This is equivalent to using references (objects) in Java or in C#.

(April 10, 2010 at 12:45 am)Tiberius Wrote: In order to be consistent, the == needs to do the same thing in every class. Comparing references is actually useful sometimes, especially if you want to avoid errors. For instance, if the creation of a new object is dependant on some random event, and you have a thread that depends on the creation of the new object, then you can't have the thread trying to access a non-existent object. Thus you'd have a check (object != null) to make sure the reference existed before continuing in the thread.
Hence the use of pointers, in C++. Natively you can't compare a value-type (except for integral primitive types) to NULL anyways. So, with that said, if you are comparing against NULL in the first place, it is impossible for you to overload the != operator for that comparison.

(April 10, 2010 at 12:45 am)Tiberius Wrote: As for the matrix class, there are far more matrix operations you can do than those. This is where overloading gets confusing. You'd have to have operators for cross product and dot product, and everything in between. Finding good operators to represent those operations would mean you have a stupid amount of operators that are non-descriptive, as opposed to the same number of methods that have *names* describing what they do. I'd love to see what operator you'd choose for "invert the matrix". I don't have that problem: invertMatrix(). Done. Why are you so afraid of decent method calls anyway?
Of course, most Matrix classes include both methods and operators, however. Generally the basic, add, subject, multiply, etc. operators are implemented.

I'm not "afraid" of method calls, I just prefer operators where operators should be used. It simplifies things, makes code more readable, and makes the code easier to debug when you come across problems.

(April 10, 2010 at 12:45 am)Tiberius Wrote: Are you fucking kidding me? This is one of my areas of expertise; I've been working on mobile devices for the past 2 years in various university projects. The top runners for mobile devices are:

1) Symbian (uses Java / C++)
2) RIM Blackberry (uses Java / C++)
3) Apple iPhone OS (uses Objective C)

Windows Mobile have 9% of the operating system market on mobile devices, behind all those three. Additionally, Android (Java based) is suspected to be in second place by 2013. So no, I think your assertion that .NET has taken "a lot of competition from Java" on mobile devices is an outright fabrication.
Eh, sorry about that. Let me separate my statements. C# has taken a lot of competition from Java. Some of that competition taken also includes mobile phones. Symbian OS actually has (from what I've heard/read) .NET Compact Framework.

But either way, you apparently know more about mobile phone development than I do, so I can't argue it. So, point taken.

(April 10, 2010 at 12:45 am)Tiberius Wrote: Well you were the one who brought mono up. I can't be blamed for a comparison I didn't even make...
You said,
Quote: it lacks the power of Java in terms of reliability and usability (on other platforms).
.NET only runs on Windows, so when you say "on other platforms", it implies mono.

(April 10, 2010 at 12:45 am)Tiberius Wrote: NASM as far as I've understood from what I just read about it, is for the Intel x86 architecture...ergo it is made specifically for one architecture, so it is a low-level language.
Alright, good. Just because something is "compiled" doesn't mean it can't be a low-level language. A compiler can be specific to an instruction set (like the NES compiler - forgot the name, however).
Reply



Messages In This Thread
Hello everyone - by cppman - April 8, 2010 at 4:30 pm
RE: Hello everyone - by Autumnlicious - April 8, 2010 at 4:55 pm
RE: Hello everyone - by fr0d0 - April 8, 2010 at 5:25 pm
RE: Hello everyone - by Minimalist - April 8, 2010 at 6:39 pm
RE: Hello everyone - by Tiberius - April 8, 2010 at 6:45 pm
RE: Hello everyone - by cppman - April 8, 2010 at 8:33 pm
RE: Hello everyone - by Minimalist - April 8, 2010 at 8:52 pm
RE: Hello everyone - by Autumnlicious - April 8, 2010 at 9:05 pm
RE: Hello everyone - by Minimalist - April 8, 2010 at 9:23 pm
RE: Hello everyone - by The_Flying_Skeptic - April 8, 2010 at 9:12 pm
RE: Hello everyone - by Disinter - April 8, 2010 at 9:47 pm
RE: Hello everyone - by cppman - April 8, 2010 at 10:10 pm
RE: Hello everyone - by Tiberius - April 9, 2010 at 8:49 am
RE: Hello everyone - by cppman - April 9, 2010 at 2:02 pm
RE: Hello everyone - by Tiberius - April 9, 2010 at 2:09 pm
RE: Hello everyone - by cppman - April 9, 2010 at 2:28 pm
RE: Hello everyone - by Tiberius - April 9, 2010 at 3:33 pm
RE: Hello everyone - by cppman - April 9, 2010 at 6:14 pm
RE: Hello everyone - by Tiberius - April 9, 2010 at 7:02 pm
RE: Hello everyone - by cppman - April 9, 2010 at 9:47 pm
RE: Hello everyone - by Tiberius - April 9, 2010 at 10:26 pm
RE: Hello everyone - by cppman - April 9, 2010 at 11:33 pm
RE: Hello everyone - by Tiberius - April 10, 2010 at 12:45 am
RE: Hello everyone - by cppman - April 10, 2010 at 2:00 am
RE: Hello everyone - by Tiberius - April 10, 2010 at 2:59 am
RE: Hello everyone - by Edwardo Piet - April 14, 2010 at 10:25 am
RE: Hello everyone - by Tiberius - April 14, 2010 at 12:40 pm
RE: Hello everyone - by fr0d0 - April 14, 2010 at 2:09 pm
RE: Hello everyone - by Minimalist - April 14, 2010 at 2:17 pm
RE: Hello everyone - by cppman - April 15, 2010 at 8:20 pm
RE: Hello everyone - by Minimalist - April 15, 2010 at 9:29 pm

Possibly Related Threads...
Thread Author Replies Views Last Post
Smile Hello, everyone Rolls 21 2017 June 27, 2020 at 9:31 am
Last Post: Fireball
  Hello Everyone! Chicken 33 3091 December 25, 2018 at 10:57 pm
Last Post: Peebothuhlu
  Hello Everyone :) , { Just an ape trying to socialize } Enlightened Ape 31 6668 April 24, 2018 at 1:22 pm
Last Post: Enlightened Ape
Wink Hello Everyone! rskovride 15 2501 February 21, 2018 at 5:45 am
Last Post: ignoramus
  Hello Everyone Shai Hulud 32 8950 May 14, 2017 at 12:04 pm
Last Post: Shai Hulud
  Hello Everyone! Driggs 22 3196 April 12, 2017 at 10:29 pm
Last Post: c172
  Hello everyone account_inactive 25 4455 April 12, 2017 at 9:55 am
Last Post: Brian37
  Hello Everyone! Flavius 9 1536 March 30, 2017 at 6:54 pm
Last Post: TheoneandonlytrueGod
  Hello everyone Yoo 11 2736 August 29, 2016 at 12:11 pm
Last Post: account_inactive
Brick Hello to everyone Wryetui 23 5196 May 4, 2016 at 9:27 pm
Last Post: ignoramus



Users browsing this thread: 3 Guest(s)