bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSAttributedString (Foundation) bug


From: Pascal Bourguignon
Subject: Re: NSAttributedString (Foundation) bug
Date: Sat, 8 Dec 2001 16:52:58 +0100 (CET)


Richard Frith-Macdonald <richard@brainstorm.co.uk> wrote:
> 
> On Saturday, December 8, 2001, at 12:25 AM, Pascal Bourguignon wrote:
> 
> >>    while (index < length);
> >>       {
> >>           statement;
> >>       }

> >     while(condition){  
> >         statement;
> >     }


> Nice try ... by demonstrably untrue.
> 
> For the case in point, a '{' *was* there, and code like 
> 'if(condition);{some-code-here}'
> is perfectly legal in C.

My point  is that by always writting  the brace on the  same line than
the while,  if, else, for, etc,  and without spaces  between the right
parenthesis,  the intruduction  of an  unwanted semi-colon  would just
jump in one's face and such an error would not pass unnoticed.

     while(condition);{some-code-here}

is valid C code, but not by my style-book. First, it would be written

     while(condition);{
         some-code-here
     }

next per  the ){  rule, it would have been written by reflex as:

     while(condition){
         ;
         some-code-here
     }

In addition, while(must_wait); is illegal by my style-book. This would
have to be written as:

     while(must_wait){
        /* wait */
     }

And:

     for(init;cond;incr_with_side_effect);

would  be  illegal  too.  First,  I've  a  preference  for  the  while
loops. But anyway it would have to be written as:

     for(init;cond;incr){ 
         side_effect;            
     }

or:
     for(init;cond;/*nop*/){
         incr_with_side_effect;
     }

but preferably:

     init;
     while(!cond){
         incr_with_side_effect;
     }
 

> We have a simple rule for GNUstep ... stick to the GNU coding
> standards  so that everyone ifs familiar with the style (a pretty
> good one), and can read  it easily.

I don't hope  to really have an influence on  the GNU coding standard,
but I believe  that my style is slightly better  than that pretty good
one. At least, it doesn't  let me make silly syntaxtical errors before
the 30th hour of continuous programming.


> Whether or not to use braces for a single statement is not covered
> in  the GNU coding style (I say, yes we should), but how to use them
> *is* -
> 
> if (condition)
>    {
>      statement;
>    }
> 
> 
> *NOT*
> 
> if(condition){statement;}

My style is:

   if(condition){
       statement;
   }



Perhaps, to make it clearer, I should indicate that my tokens are:

    while(        if(           for(           ){       

    dp{           }else{        }else if{      }

    }while(       


not just: while, if, for, do, else, {, }, (, ).


         

       

-- 
__Pascal_Bourguignon__              (o_ Software patents are endangering
()  ASCII ribbon against html email //\ the computer industry all around
/\  and Microsoft attachments.      V_/ the world http://lpf.ai.mit.edu/
1962:DO20I=1.100  2001:my($f)=`fortune`;  http://petition.eurolinux.org/

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/IT d? s++:++(+++)>++ a C+++  UB+++L++++$S+X++++>$ P- L+++ E++ W++
N++ o-- K- w------ O- M++$ V PS+E++ Y++ PGP++ t+ 5? X+ R !tv b++(+)
DI+++ D++ G++ e+++ h+(++) r? y---? UF++++
------END GEEK CODE BLOCK------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]