Re: [Opengl3dwm-devel] Spacing and indentation ISSUES!
Status: Pre-Alpha
Brought to you by:
zarnick
|
From: Alon D. <alo...@gm...> - 2006-04-12 18:35:48
|
That is not the main point I was trying to bring up, but spacing in genearl=
.
Errm........................
On 4/12/06, bul...@gm... <bul...@gm...> wrote:
>
> erm, is it just me or is that not K&R?
>
> I thought else statements were like this:
>
> }else{
>
> and not like
>
> }else
> {
>
> anyways, doesn't matter I hate it:)
> On Wednesday 12 April 2006 07:46, Alon Dakik wrote:
> > 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)
> > done =3D TRUE;
> > if(event.type=3D=3DSDL_KEYDOWN){
> > if(event.key.keysym.sym=3D=3DSDLK_ESCAPE)
> > done =3D TRUE;
> > }
> > }
> >
> > Spaced out code:
> >
> >
> > while ( SDL_PollEvent(&event) ) {
> >
> > if( event.type=3D=3DSDL_QUIT )
> > done =3D TRUE;
> >
> > if ( event.type=3D=3DSDL_KEYDOWN ) {
> > if ( event.key.keysym.sym =3D=3D SDLK_ESCAPE )
> > 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 :/
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting
> language
> that extends applications into web and mobile media. Attend the live
> webcast
> and join the prime developer group breaking into this new coding
> territory!
> http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&dat=
=3D121642
> _______________________________________________
> Opengl3dwm-devel mailing list
> Ope...@li...
> https://lists.sourceforge.net/lists/listinfo/opengl3dwm-devel
>
|