Does C++ long for VB?
-
Or maybe Pascal.
class A
{
private:
// A lot of members.
public:
bool operator==(const A &rhs) const { return (this == &rhs); }bool operator=(const A &rhs) const { // Compares the members. } bool operator!=(const A &rhs) const { return (!operator=(rhs)); }
};
-
Or maybe Pascal.
class A
{
private:
// A lot of members.
public:
bool operator==(const A &rhs) const { return (this == &rhs); }bool operator=(const A &rhs) const { // Compares the members. } bool operator!=(const A &rhs) const { return (!operator=(rhs)); }
};
-
Or maybe Pascal.
class A
{
private:
// A lot of members.
public:
bool operator==(const A &rhs) const { return (this == &rhs); }bool operator=(const A &rhs) const { // Compares the members. } bool operator!=(const A &rhs) const { return (!operator=(rhs)); }
};
Seriously, this should be outlawed. Why use redefine the == operator to compare the addresses, not the values, of the operands? Why redefine the assignment operator to perform a comparison? C++ might be thought to be a horrible language by some (sometimes including me), but why make it even worse by redefining operators to have inconsistent semantics? I truly desire that the author of that code die a horrible death.
Eduardo León
-
Seriously, this should be outlawed. Why use redefine the == operator to compare the addresses, not the values, of the operands? Why redefine the assignment operator to perform a comparison? C++ might be thought to be a horrible language by some (sometimes including me), but why make it even worse by redefining operators to have inconsistent semantics? I truly desire that the author of that code die a horrible death.
Eduardo León
Right. It's a kind of booby trap. But I was surprised rather than being angry when I found it.
-
Or maybe Pascal.
class A
{
private:
// A lot of members.
public:
bool operator==(const A &rhs) const { return (this == &rhs); }bool operator=(const A &rhs) const { // Compares the members. } bool operator!=(const A &rhs) const { return (!operator=(rhs)); }
};
no. it doesn't.
-
no. it doesn't.
The language doesn't, but maybe the author of this crapware does. What he should get instead is death by redefining his extremities as hamburger.
-
Or maybe Pascal.
class A
{
private:
// A lot of members.
public:
bool operator==(const A &rhs) const { return (this == &rhs); }bool operator=(const A &rhs) const { // Compares the members. } bool operator!=(const A &rhs) const { return (!operator=(rhs)); }
};
-
Seriously, this should be outlawed. Why use redefine the == operator to compare the addresses, not the values, of the operands? Why redefine the assignment operator to perform a comparison? C++ might be thought to be a horrible language by some (sometimes including me), but why make it even worse by redefining operators to have inconsistent semantics? I truly desire that the author of that code die a horrible death.
Eduardo León
How embarrassing, I did not immediately notice the issue with "redefining ==" - you are rewarded with a free book tip, Jeff Johnson's latest "Designing with the Mind in Mind", might be alternately titled "Don't even TRY to make me think". This is a brief very-well-edited book, if you haven't got a lot of time the book-price for this slim volume is OK because you learn a lot in few pages, there's no "padding".
Also on the same topic, somewhere in Gary Kasparov's "How Life Imitates Chess", he describes how he carefully designed his first try at a chess website, because after all who could be expected to think more than world-class-chess-player-wannabe's. But the usability cameras captured these folks just instinctively clicking without a conscious thought, the way we all do, sigh.pg--az
-
How embarrassing, I did not immediately notice the issue with "redefining ==" - you are rewarded with a free book tip, Jeff Johnson's latest "Designing with the Mind in Mind", might be alternately titled "Don't even TRY to make me think". This is a brief very-well-edited book, if you haven't got a lot of time the book-price for this slim volume is OK because you learn a lot in few pages, there's no "padding".
Also on the same topic, somewhere in Gary Kasparov's "How Life Imitates Chess", he describes how he carefully designed his first try at a chess website, because after all who could be expected to think more than world-class-chess-player-wannabe's. But the usability cameras captured these folks just instinctively clicking without a conscious thought, the way we all do, sigh.pg--az
pg--az wrote:
How embarrassing, I did not immediately notice the issue with "redefining ==" - you are rewarded with a free book tip, Jeff Johnson's latest "Designing with the Mind in Mind", might be alternately titled "Don't even TRY to make me think". This is a brief very-well-edited book, if you haven't got a lot of time the book-price for this slim volume is OK because you learn a lot in few pages, there's no "padding".
Thanks. I am good at designing consumable classes/services/subsystems/frameworks that do not make programmers think more than they are supposed to, and sometimes make them think less. Perhaps because I am a fellow programmer, and I especially like systems programming. On the other hand, I am terrible at designing user interfaces that do not make users think more. Designing user interfaces is more of an art than a technical discipline, especially if your users are not engineers, accountants or finance guys.
pg--az wrote:
Also on the same topic, somewhere in Gary Kasparov's "How Life Imitates Chess", he describes how he carefully designed his first try at a chess website, because after all who could be expected to think more than world-class-chess-player-wannabe's. But the usability cameras captured these folks just instinctively clicking without a conscious thought, the way we all do, sigh.
Help: First read without the parentheses. Then use the information in parentheses to add context/extra information/gratuitous pedantry. Well, after having spent my whole childhood and adolescence believing I was inherently superior because I could do math and science (this is what gives you license to be pedant in first place, but, wait, there is more), learn languages with ease (by tackling grammar and syntax first, and only then vocabulary, unlike most people), play chess (I was second board of my first school's team (not because the guy on first board was stronger, but because he was more calm than I, and could handle losses better) and first board of my second school's team), understand music theory (which is nothing more than "applied" (for non-real world definitions of "applied") integer arithmetic modulo 12), tell a musical note right after I listened to it (aka absolute pitch, which I could have applied in real life to impress chicks by playing their favorite songs, but I had my own set of favorite songs, mainly Dream Theater "songs" back then, and I was like "I do not p
-
pg--az wrote:
How embarrassing, I did not immediately notice the issue with "redefining ==" - you are rewarded with a free book tip, Jeff Johnson's latest "Designing with the Mind in Mind", might be alternately titled "Don't even TRY to make me think". This is a brief very-well-edited book, if you haven't got a lot of time the book-price for this slim volume is OK because you learn a lot in few pages, there's no "padding".
Thanks. I am good at designing consumable classes/services/subsystems/frameworks that do not make programmers think more than they are supposed to, and sometimes make them think less. Perhaps because I am a fellow programmer, and I especially like systems programming. On the other hand, I am terrible at designing user interfaces that do not make users think more. Designing user interfaces is more of an art than a technical discipline, especially if your users are not engineers, accountants or finance guys.
pg--az wrote:
Also on the same topic, somewhere in Gary Kasparov's "How Life Imitates Chess", he describes how he carefully designed his first try at a chess website, because after all who could be expected to think more than world-class-chess-player-wannabe's. But the usability cameras captured these folks just instinctively clicking without a conscious thought, the way we all do, sigh.
Help: First read without the parentheses. Then use the information in parentheses to add context/extra information/gratuitous pedantry. Well, after having spent my whole childhood and adolescence believing I was inherently superior because I could do math and science (this is what gives you license to be pedant in first place, but, wait, there is more), learn languages with ease (by tackling grammar and syntax first, and only then vocabulary, unlike most people), play chess (I was second board of my first school's team (not because the guy on first board was stronger, but because he was more calm than I, and could handle losses better) and first board of my second school's team), understand music theory (which is nothing more than "applied" (for non-real world definitions of "applied") integer arithmetic modulo 12), tell a musical note right after I listened to it (aka absolute pitch, which I could have applied in real life to impress chicks by playing their favorite songs, but I had my own set of favorite songs, mainly Dream Theater "songs" back then, and I was like "I do not p
leonej_dt wrote:
e believing I was inherently superior because I could do math and science
Yes, me too. But what might count even more is the "Visio-spatial tasks", like say picking up a pail of water with a "Cat 432 Backhoe-Loader". If you go to youtube and search for (( BBC Secret of the Sexes (part 2) )), you get the thumbnail of the woman in the cab with the yellow-hard-hat. This is a FASCINATING video, probably motivating you to go back and get the context from part 1, parts 3 and 4 are also great.
leonej_dt wrote:
learn languages with ease
You're one-up on me there, but again if you goto youtube and search for (( tammet icelandic language )), the fourth hit mentions that Daniel Tammet learned icelandic in a week, to a sufficient conversational standard to pass muster on a TV Talk Show ! I forget exactly which of the videos shows snippets from his week-of-learning, and then the final TV appearance, but this is amazing. It motivated me to read his book "Embracing the Wide Sky" which contains great insight into how being multilingual really DOES have "spin-off" benefits in other areas, especially of course if you got thay way as a toddler.
Probably you should not dare to reply, these are the top tidbits on my personal armchair quest to get a meta-model of my own mind, but most likely we could continue WAY off-topic on this.pg--az
-
Or maybe Pascal.
class A
{
private:
// A lot of members.
public:
bool operator==(const A &rhs) const { return (this == &rhs); }bool operator=(const A &rhs) const { // Compares the members. } bool operator!=(const A &rhs) const { return (!operator=(rhs)); }
};
A new low in obfuscation. Why use just the comparison operators when you can involve the rest in the task!! I'm curious what this person was thinking in doing this? Of course, there is the attendant fear of discovering what they were thinking.. I retract my question.