Reputation
3,871
Top tag
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
2 20 34
Impact
~189k people reached

Jul
16
comment Is it a good idea to “#define me (*this)”?
Not to mention that using this actually helps you write your code faster because the IDE can display a drop-down listing all the member variables, from which you can easily select a member without typing most of its name at all. So it's not even good from a coding efficiency standpoint.
Jul
16
comment Is it a good idea to “#define me (*this)”?
@BЈовић: How else are you supposed to distinguish between member and local variables? Either you change the naming convention, or you use this->. I don't mean for the compiler's sake, I mean for the sanity of the next poor programmer who has to read your code. If you don't write this-> then you're going to waste the people's valuable time when they go hunting for the scope of the variable. That's at least 5 seconds of thinking that could be turned into 1 second, with 4 more left to spend on more important things. Multiplied by the number of times your code has to be read.
Jul
16
comment Is it a good idea to “#define me (*this)”?
"Using this-> everywhere is just plain stupid" uh, no, it's pretty smart. I could just as well argue not doing so is stupid. It lets you avoid screwing with instance variable names by prefixing them with m_ or _ or whatever just because you're too lazy to type this->, making the code that much more readable.
Jul
15
comment Is it a good idea to “#define me (*this)”?
@LokiAstari: Nothing in the question even remotely hints at the OP wondering whether this-> "is necessary". In fact, the OP says he is using this-> in spite of the fact that it's not necessary. The question is about whether me. should be used instead of this->, which this answer doesn't actually answer.
Jul
14
comment Is it a good idea to “#define me (*this)”?
@JanHudec: Lowercase is for system-specific extensions? Could you post a reference to the part of the C++ standard that indicates this?
Jul
14
comment Is it a good idea to “#define me (*this)”?
"In C++, you almost never have to write this" that's a totally unrelated convention to the question. Some people (like me) prefer to write this to explicitly make it clear that the variable is not local to the method. The question here is about whether the macro me should exist, not whether this is something that should be used.
Jul
10
comment Why is software OS specific?
@MSalters: Not quite -- if you (and Marcin) read my very first comment, you will see I was already aware of that and mentioned it before either of you did. However, that's not what Marcin is saying, even though maybe that's what he thinks he's saying. He's making a stronger claim: that there exists a "POSIX binary format" that Windows can execute, for which I'm asking him to provide a reference, because (correct me if I'm wrong) I'm fairly sure that even the "POSIX" executables in Windows in fact use the PE file format, not some "POSIX binary format" (if such a thing even exists).
Jul
9
comment Why is software OS specific?
@Marcin: What kind of a reference is that supposed to be?! The word POSIX doesn't even appear on there, let alone a mention of executable file formats. As for yours, here you go; your turn.
Jul
9
comment Why is software OS specific?
@Marcin: (1) Like I said, the X in POSIX stands for UNIX. It is not a standard that was meant to be followed by other OSes, it was just an attempt to reach a common denominator between the various Unixes, which is great but not that amazing. The fact that there are multiple flavors of Unix OSes out there is completely irrelevant to the point I've been trying to make regarding compatibility across other operating systems than Unix. (2) Can you provide a reference for #2?
Jul
9
comment Why is software OS specific?
@Marcin: Seems like you don't consider Windows to be an OS. (Or are you saying Windows can run POSIX binaries?!) For the purposes of my answer POSIX isn't the kind of standard I'm referring to. The X in POSIX stands for Unix. It was never intended to be used by e.g. Windows, even though Windows does happen to have a POSIX subsystem.
Jul
9
comment Why do operating systems do low level stuff in C and C++? Why not just C++?
@TMN: What the heck is "the RT kernel"? The kernel is the same old thing it always was, the NT kernel.
Jul
9
answered Why is software OS specific?
Jun
20
comment Why was C# made with “new” and “virtual+override” keywords unlike Java?
You should learn C++!
Jun
11
comment Is my work on a developer test being taken advantage of?
Just make sure you don't get yourself into a situation where they could sue you for unauthorized access or modifications to their code.
May
24
comment Should I follow the normal path or fail early?
@mirabilos: Er, I never said it's good advice, nor that it's always correct. Like many other things, it's a reasonable first-order approximation, and I said I'm wondering if that's what the attempt was.
May
24
comment Should I follow the normal path or fail early?
@mirabilos: not sure what you're trying to say. I am aware how branch prediction works, and there is nothing that restricts it to assembly. When you have an if statement there is necessarily going to be a jump there, and not-taken implies executing the body of the 'if', so hopefully it's the common code.
May
22
comment Where did the notion of “one return only” come from?
@sbi: Or you could just learn to do it right from the beginning so that you can structure your code readably without sacrificing the optimization or hindering debugging. I don't think I've ever seen the single-return convention harm code in some way, but I've definitely seen multiple returns rear their ugly heads when I'm trying to set a breakpoint to find what values a function is returning and inevitably end up missing one of the 4 returns in the function.
May
22
comment Where did the notion of “one return only” come from?
You still want to do this with C++, because returning a single object lets the compiler avoid copies and moves entirely.
May
22
comment Should I follow the normal path or fail early?
Is it just me who thinks this has nothing to do with readability, but instead was probably just a misguided attempt at optimizing for static branch prediction?
May
3
comment If null is bad, why do modern languages implement it?
@MartinJames: The fewer invalid states your program has, the fewer ways it can be incorrect. Simple as that.