[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

>prefixing class members with m_

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 19
Thread images: 2

File: 010.jpg (62KB, 604x453px) Image search: [Google]
010.jpg
62KB, 604x453px
>prefixing class members with m_
>>
>>61837952
you're fucking retarded
>>
>>61838166
No u
>>
>>61838184
there is nothing wrong with hungarian notation, as a matter of fact it was quite useful before we had auto complete.
>>
File: IMG_0348.jpg (27KB, 400x400px) Image search: [Google]
IMG_0348.jpg
27KB, 400x400px
>adopting unfamiliar conventions
The scoundrels!
>>
>>61838224
"Encoding the type of a function into the name (so-called Hungarian notation) is brain damaged—the compiler knows the types anyway and can check those, and it only confuses the programmer."
-Linus

For once I agree with Linus
>>
>>61838224
It was never useful. Knowing the concrete type of a variable is the opposite of abstraction.
>>
>>61838269
Did he say something more about that?

>>61838283
Maybe you should try some low level programming before generalizing too much.
>>
>>61838544
>Maybe you should try some low level programming before generalizing too much.
Even in that case. You can always abstract.
>>
>>61838544
Hungarian is actually more useful in high level. It's still stupid because you can always backtrack. That's if design itself isn't crap to begin with. Hungarian is a poor substitute for proper design.
>>
>>61838640
Achieving "proper design" is often pretty hard when you have to work with existing code, need to do modification and can't afford to rewrite everything properly for whatever reason (try maintaining C++ code written by incompetent colleague who left the job a year ago).
Anyway, seems like I had a wrong idea about what "Hungarian" actually is. This article is worth looking into:
https://www.joelonsoftware.com/2005/05/11/making-wrong-code-look-wrong/
>>
>>61837952
I fucking hate seeing this in C++ with a passion.

The only fucking reason people even do this in the first place is because `this->` before accessing a class member is optional.

If you have the slightest bit of discipline and preface class member usage with `this->` though, the m_ practice becomes retarded. Not to mention that if you don't do this, and I see `foo` being used in a function but not declared in said function, I now have to wonder whether that's a global or a class member.

It also makes it more difficult to determine whether or not a method can be made const after writing it, since if you do preface class member usage with `this->`, then all you have to do is:
1: See if you can spot a this-> being used for accessing a member
2: See if methods called in this method are const as well.
>>
>>61838269
>For once
Back to re dit, Stallman
>>
>>61838283
You are absolute cancer.
>>
>>61839664
Ok. What floats your boat.
>>
why not just "_"?
>>
>>61838224
>>61838269
Raymond Chen wrote a post a while back about how there used to be two kinds of Hungarian notation at Microsoft, but the wrong one won, and became associated with the name.

The bad kind is encoding into the variable name the kind of thing that it's easy for your editor and compiler to know. Is a member variable, is this or that type, etc. The good kind, now extinct, was encoding into the variable name something about what it represents beyond the type. I think the example was a prefix to distinguish between coordinate-relative-to-one-thing and coordinate-relative-to-another-thing. They're both ints, and it's not a syntax error to compare them, add them, etc, but it's certainly a logic error.
>>
>>61837952
The verbosity is well worth the absolute clarity it provides.
>>
>>61838936
Nice article, thanks
Thread posts: 19
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.