[Opengl3dwm-devel] Spacing and indentation ISSUES!
Status: Pre-Alpha
Brought to you by:
zarnick
|
From: Alon D. <alo...@gm...> - 2006-04-12 04:46:59
|
Okay, You guys need to put line spaces between statements. I found
several obvious bugs that you guys missed.
Here is an exact copy of 2 sections in the code from main.c
Your code:
for(i=3D0;i<10;i++){
Cubes[i].type =3D i;
Cubes[i].size =3D i*100;
Cubes[i].posx =3D 2+i;
Cubes[i].posy =3D 0.0;
Cubes[i].posz =3D i%3;
Cubes[i].blend =3D TRUE;
if(i%2=3D=3D0){
Cubes[i].roty =3D 1;
Cubes[i].ang =3D ang;
}
else
Cubes[i].blend=3DFALSE;
Cubes[i].selected=3DFALSE;
Cubes[i].id=3Di;
}
//Let's start the SDL
mode =3D SDL_OPENGL|SDL_HWPALETTE;
if(config.fscreen =3D=3D TRUE)
mode |=3D SDL_FULLSCREEN;
FMLog_log("[I] Starting SDL.\n",LOGVERBOSE);
if(FMSystem_initSDL(mode,config)!=3DSUCESS){
FMError_perror("FMSystem");
exit(errno);
}
Here is what I think the above code should look like. Notice you
missed brackets on the else statement.
for (i=3D0; i<10; i++ ){
Cubes[i].type =3D i;
Cubes[i].size =3D i*100;
Cubes[i].posx =3D 2+i;
Cubes[i].posy =3D 0.0;
Cubes[i].posz =3D i%3;
Cubes[i].blend =3D TRUE;
if ( i%2 =3D=3D 0 ){
Cubes[i].roty =3D 1;
Cubes[i].ang =3D ang;
}
else {
Cubes[i].blend=3DFALSE;
Cubes[i].selected=3DFALSE;
Cubes[i].id=3Di;
}
}
//Let's start the SDL
mode =3D SDL_OPENGL|SDL_HWPALETTE;
if(config.fscreen =3D=3D TRUE)
mode |=3D SDL_FULLSCREEN;
FMLog_log("[I] Starting SDL.\n",LOGVERBOSE);
if(FMSystem_initSDL(mode,config)!=3DSUCESS){
FMError_perror("FMSystem");
exit(errno);
}
See how much cleaner that is? and how you missed { } on the else
statement? You should write code just like you write your own
language. With
spaces and line breaks to make it more readable and easier to find bugs.
Another example..
Your code...
while(SDL_PollEvent(&event)){
if(event.type=3D=3DSDL_QUIT)
=09done =3D TRUE;
if(event.type=3D=3DSDL_KEYDOWN){
=09if(event.key.keysym.sym=3D=3DSDLK_ESCAPE)
=09 done =3D TRUE;
}
}
Spaced out code:
while ( SDL_PollEvent(&event) ) {
if( event.type=3D=3DSDL_QUIT )
=09done =3D TRUE;
if ( event.type=3D=3DSDL_KEYDOWN ) {
=09 if ( event.key.keysym.sym =3D=3D SDLK_ESCAPE )
=09 done =3D TRUE;
}
}
That is a whole lot more readable than what is currently in main.c.
I'm just trying to add functionality for someone to type in a
directory and use my FMDir lib... but right now I have to clean up
code :/
|