|
-
March 9th, 2010, 12:09 PM
#5
Re: Reinitializing variables & their speed sacrifice
 Originally Posted by GCDEF
I just bought a PC with 6GB of RAM for $409. RAM is cheap.
Wish I could have 1 too..
 Originally Posted by GCDEF
You want to be careful, but if you're reusing variables rather than allocating a few extra ints, you're not programming well.
I only use variables which I am **** sure wont be used again, as in a case switch nearing program termination. But if a problem can be done without the need of additional 2 bytes, its always better. For small problems this can be rightfully achieved. Though I personally declare separate variables in my day-to-day projects which span thousands of lines, just for the sake of better understandability of various variables.
Default constructors don't initialize memory,
Yes, I know, but they do initialize. so maybe i "guess" int
As I said before, it's just a safe habit to develop so that you don't forget to do it when you need to.
Whenever something can be done in two ways, someone will be confused. Whenever something is a matter of taste, discussions can drag on forever. Stick to one pointer per declaration and always initialize variables and the source of confusion disappears.
-Bjarne Stroustrup's Comment
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|