memcpy(stuct array pointer struct array point)
Ok, phew! I turned on that code completion thing and it made editing painful. I turned it off because of this.
Are there any tricks that make it work better or an option to assign a hot key to activate for only just this once sort of thing?
Are there any tricks that make it work better or an option to assign a hot key to activate for only just this once sort of thing?
Zekaric Wrote:Ok, phew! I turned on that code completion thing and it made editing painful. I turned it off because of this.
Are there any tricks that make it work better or an option to assign a hot key to activate for only just this once sort of thing?
Is it coming automatically up for you or something? Generally, I have it set to indicate when it could possibly complete something and then I just choose to use it. Check your Xcode prefs. Oh, and the hot key (which I think is the default) is Cmd-.
The brains and fingers behind Malarkey Software (plus caretaker of the world's two brattiest felines).
Yes. Every time, even just cursoring around it'll try to keep up. I'll look at the options more closely then. Thanks for heads up.
Zekaric Wrote:If you have a terminology and you stick with it then there isn't much of a problem. Personally I hate ijk for loop variables because ijk has meaning in mathematics. Similary why I don't generally use xyz or uvw either. However I use all the time abc (efg if needed) for unimportant loop varaibles. Not everything needs to be spelt out.
...
I, j, and k are used in mathematics, and their prime use is...iterators
for sums, products, series, and whatnot. They are also used to denote the base vectors in 3D, and complex numbers' imaginary parts, but that is just niche uses.X, y, z, are general variables, u, v, w are general vector variables, and a, b, c generally refer to constants.
So, make sure you choose to stick with the right terminology.
Not so niche when you are dealing with quarternions which seem to be somewhat of a fad at the moment in 3D graphics. This is why I keep them out of being iterators. Similarly for xyz which are cartesian names and uvw being texture space names. All related to 3D in someway.
There are arguments in any way you defend your position.
There are arguments in any way you defend your position.
The reason I dislike i, j, k, etc. for iterators is that they don't give any hint about what they're iterating over. The convention I use for iterator variables is objectIndex. For example:
fileNameIndex and charIndex make the meaning of the variables immediately clear. If I'd named them i and j, and there was a lot of complicated code in the body of the inner loop, I would likely have to refer back to the top of the loop at least a few times to figure out which variable is which. The more nested loops with nonsensical iterator names, the worse it gets. I despise having to artificially attach a meaning to an identifier that isn't self-explanatory; my brain just doesn't work like that.
- Alex Diener
Code:
int numberOfFileNames;
char ** fileNameList;
int fileNameIndex, charIndex, length;
for (fileNameIndex = 0; fileNameIndex < numberOfFileNames; fileNameIndex++) {
for (charIndex = strlen(fileNames[fileNameIndex]); charIndex >= 0; charIndex--) {
if (fileNames[fileNameIndex][charIndex] == '.') {
fileNames[fileNameIndex][charIndex] = '\x00';
break;
}
}
}fileNameIndex and charIndex make the meaning of the variables immediately clear. If I'd named them i and j, and there was a lot of complicated code in the body of the inner loop, I would likely have to refer back to the top of the loop at least a few times to figure out which variable is which. The more nested loops with nonsensical iterator names, the worse it gets. I despise having to artificially attach a meaning to an identifier that isn't self-explanatory; my brain just doesn't work like that.
- Alex Diener
Zekaric Wrote:Not so niche when you are dealing with quarternions which seem to be somewhat of a fad at the moment in 3D graphics.
Fad?! They're useful!
I don't use them a whole heck of a lot, but when I want to rotate something around an arbitrary axis they come in handy.
Quote:uvw being texture space namesyeah, thats true, they are commonly used as texture name variables. But there variables so they can be used for anything..
I use whatever variable name I think is suitable, I dont think its good practice to rigidly define certain things such as i is for looping, or j is for one loop inside another. It confuses people and gives them extra things to try and remember when they are learning.
I think to a small degree you will always learn programming style from who teaches you, or what book you learn from.
Sir, e^iπ + 1 = 0, hence God exists; reply!
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| mutable array - fill with objects - draw to view | burrows111 | 2 | 2,278 |
Apr 21, 2010 02:32 PM Last Post: burrows111 |
|
| Malloc() Struct with NSString Inside? | Graphic Ace | 3 | 3,868 |
Jan 26, 2010 05:32 PM Last Post: cmiller |
|
| Finding the closest point to (x1,y1) in array of [x1,y1,z1,x2... | mikey | 17 | 7,991 |
Aug 28, 2009 08:12 AM Last Post: mikey |
|
| memory pointer tricks? | Toontingy | 2 | 3,695 |
Mar 31, 2009 02:35 AM Last Post: Ingemar |
|
| pointer cleanup questions | kendric | 7 | 3,882 |
Mar 29, 2009 07:48 PM Last Post: kendric |
|

