We've all done it. It's almost a rite of passage, but it needs to stop. Guessing at code means you've abandoned all paths of knowledge and logic and are now flailing hopelessly at some code.
Case in point, pointers. Who hasn't seen a error message like this?
There used to be a time, for all of us, where we'd start throwing * &'s around hoping the error would magically go away and the wizard who lives in the computer, whom we have somehow angered, is now calmed.
Do not guess! If you don't know what the issue is ask. If you don't understand a concept, read about it. When you're making a 2D array of pointers pointing to pointers because you misused a typedef, you need to take a step back! Get the concept to work at the simplest level and progress from there.
- A single pointer to a single object.
- An array of pointers to objects.
- A pointer to a pointer of an object.
- An array of pointers to pointers of an object.
Use a logical progression. Jumping around, throwing your arms up, and throwing in random bits of code makes about as much sense as skipping steps when defusing a bomb. Don't do it.
Case in point, pointers. Who hasn't seen a error message like this?
Quote
error C2440: '=' : cannot convert from 'int' to 'int *'
There used to be a time, for all of us, where we'd start throwing * &'s around hoping the error would magically go away and the wizard who lives in the computer, whom we have somehow angered, is now calmed.
Do not guess! If you don't know what the issue is ask. If you don't understand a concept, read about it. When you're making a 2D array of pointers pointing to pointers because you misused a typedef, you need to take a step back! Get the concept to work at the simplest level and progress from there.
- A single pointer to a single object.
- An array of pointers to objects.
- A pointer to a pointer of an object.
- An array of pointers to pointers of an object.
Use a logical progression. Jumping around, throwing your arms up, and throwing in random bits of code makes about as much sense as skipping steps when defusing a bomb. Don't do it.
5 Comments On This Entry
Page 1 of 1
Locke
20 May 2010 - 04:49 PM
I don't prefer to think of it as using The Force...I just use The Force.
Page 1 of 1
← January 2022 →
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 | 31 |
Tags
My Blog Links
Recent Entries
Recent Comments
Search My Blog
24 user(s) viewing
24 Guests
0 member(s)
0 anonymous member(s)
0 member(s)
0 anonymous member(s)



5 Comments









|