|
The C++ way is: always use objects or references unless you need to use pointers. If you must use pointers then prefer smart pointers. Basically, make life as easy for yourself as possible. Only make it difficult when you have to.
Kevin
|
|
|
|
|
Cedric Moonen wrote: I never understood why people were using the this pointer everytime they access a member variable
matter of readability of the code... i use it also but muchfor member functions (for data members, the leading m_ already tells it's a member of the class)
|
|
|
|
|
I don't find that very readable in fact
For member variables, I use the leading m_ as you do. But for member functions, in fact, as I almost never have global functions,I don't need the this .
|
|
|
|
|
i don't use Globals either, but that's a matter of taste i believe... you don't like it, i do... maybe a poll could tell us which rate of the population here uses this syntax
|
|
|
|
|
Cedric Moonen wrote: in fact, as I almost never have global functions,
By "global functions", do you mean you never have functions outside of classes, or that all your standalone functions are in their own namespace?
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Zac Howland wrote: By "global functions", do you mean you never have functions outside of classes, or that all your standalone functions are in their own namespace?
I mean I almost never have functions outside of classes. Of course, I still call global functions from the API (I didn't think of that when I posted my message ) but in general you I recognize them easily.
|
|
|
|
|
Ah, I see. Now my question would be, why the hell not!? You force yourself into the limitations of OOD by choice? There are actually some functions you can't write as member functions (at least not and have them functional).
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Zac Howland wrote: You force yourself into the limitations of OOD by choice?
Not at all. In fact, I have in general some functions that are global but they are limited (and then, I use namespace if it is possible to group them). In fact, I never came to a situation like: "ok, I have this function and I don't know in which class to put it, let's make a class to wrap it".
|
|
|
|
|
Cedric Moonen wrote: Not at all. In fact, I have in general some functions that are global but they are limited (and then, I use namespace if it is possible to group them). In fact, I never came to a situation like: "ok, I have this function and I don't know in which class to put it, let's make a class to wrap it".
Ah, so you do use globals behind a namespace then? You had me worried there for a second
Generally, when I'm writing classes, I try to not put as many functions as possible (that make sense, obviously) inside the class. They will be "packaged" with the class (usually defined in the same header file and part of the same namespace), but not actually be in the class.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Cedric Moonen wrote: I never understood why people were using the this pointer everytime they access a member variable
Honestly, I find that most people use it because typing "this->" will trigger Intellisense so they don't have to type out the whole member name they are trying to access (e.g. laziness).
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Zac Howland wrote: I find that most people use it because typing "this->" will trigger Intellisense
And typing all that and scrolling through list of possible auto completes is more efficient?
|
|
|
|
|
Mark Salsbery wrote: ...and scrolling through list of possible auto completes...
If the list even shows up.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: If the list even shows up.
He he
Who am I to talk....I still use Hungarian Notation (dwVariable, nVariable, etc.) so I'm sure what
variable types are at a glance. Lots of people laugh at that but Microsoft uses it in their
code and Microsoft is our master therefore we must obey.
Mark
|
|
|
|
|
Mark Salsbery wrote: I still use Hungarian Notation
Be careful, you might start a religious war!
Kevin
|
|
|
|
|
Hey wasn't there "Polish" notation at one time. Something to do with calculators and algabraic
notation...
|
|
|
|
|
Mark Salsbery wrote: Who am I to talk....I still use Hungarian Notation (dwVariable, nVariable, etc.) so I'm sure what
variable types are at a glance.
Yeah, I still do that in my code as well ... and even in the Java code I was writing not too long ago .
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Zac Howland wrote: Yeah, I still do that in my code as well ... and even in the Java code I was writing not too long ago
I tried briefly at one time to stop using it and be "cool" but it drove me nuts having to
look for types when I'd rather just have a good idea (KNOW) just by looking at it.
Thankfully, I remember NO JAVA. Last time I used it it was version 1.x and compiler was command-
line. If I ever have to use it again I'll fall on my sword
Cheers,
Mark
|
|
|
|
|
Mark Salsbery wrote: And typing all that and scrolling through list of possible auto completes is more efficient?
To me, no. I type faster than the IDE triggers Intellisense anyway. But I've seen coworkers do it for just that reason (and "claim" higher efficiency).
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
IntelliSense is for people like me who are crap typists.
Kevin
|
|
|
|
|
Well, if carpel tunnel sets in because I program at 80 words a minute ... I might be right there with you
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Zac Howland wrote: I find that most people use it because typing "this->" will trigger Intellisense
What's wrong with pressing the 'Ctrl' Key & Space Bar? Heck type the first few characters and if its unique VS 6 will fill in the rest for you.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
A CString is actually a pointer. It's length is four bytes, same as any pointer. You can say that a CString is char* on steroids.
Therefore, using CString* will not help you with memory management. It will only introduce errors. Use the object itself, and familiarise yourself with all the great functions that come with it.
Regards, Haakon S.
|
|
|
|
|
hello everyone!! i want to know,
1)what are .pst files??
2)what is the structure of .pst files???
can anyone please provide me any link where i can get the info about them. thanks in advance...
vijay.
|
|
|
|
|
vijay7173 wrote: 1)what are .pst files??
outlook archives
vijay7173 wrote: 2)what is the structure of .pst files???
dunno, certainly proprietary format...
read here[^]
|
|
|
|
|
thanks for the reply. i went through the info given by u. but i want to know more about them. i want to know how the .pst files are physically stored. i heard they have different physical layout when compared to other files. so, can anyone give any info about the physical layout of the .pst files?? thanks...
vijay.
|
|
|
|