why no "do : until"?
Grant Edwards
grante at visi.com
Wed Jan 3 09:45:29 EST 2001
In article <slrn9550fe.rvi.kc5tja at garnet.armored.net>, Samuel A. Falvo II wrote:
>On Tue, 02 Jan 2001 21:19:19 GMT, Grant Edwards wrote:
>>>while (1)
>>> {
>>> T = f();
>>> if (T < 25)
>>> break;
>>> }
>>
>>I used that C indentation style for years, but I finally gave
>>up since a) I could never get editors and the "indent" program
>>to do it automatically, and b) nobody else on my projects
>>wanted to do it that way, and it's important that all the
>>source code on a project be indented consistently.
[...]
>To make it self-consistent, you need to do this:
>
>void f2( int c )
> {
> int x = 0;
>
> while( x < c )
> {
> printf( "X=%d\n", x );
> x++;
> }
> }
That's how I did it. Except I used generally used 2 spaces per
level instead of 3. That style was a hold-over from how
I learned to do write Pascal:
if whatever then
begin
do something;
do something else
end;
>Though both methods are equally readable to me, I consider it
>to be rather ugly syntax.
Ya wanna talk about ugly? Apparently people pay prefectly good
money for Pontiac Aztecs. ;)
Personally, I find either style to be infinitely preferable to
the K&R style:
if (whatever) {
do something;
do something else;
} else {
yet another thing;
}
I simply can't read read code like that, and generally do an
'indent -gnu' on it before I try to figure out what's going on...
--
Grant Edwards grante Yow! .. does your DRESSING
at ROOM have enough ASPARAGUS?
visi.com
More information about the Python-list
mailing list