C's syntax (was Re: Python Formatted C Converter (PfCC))

Alex Martelli aleaxit at yahoo.com
Thu Oct 26 05:18:36 EDT 2000


> I agree on not allowing '=' in a condition, but it is nice for
> testing bits if one can say
> 
> if (var & 0x01) {

It's nice, but sometimes that & in such constructs is a typo
for &&.  If, in a hypothetical no-compatibility-constraints
variant of C, the latter operator is renamed to 'and', then
the problem vanishes.  If && must stay, i.e. in a minimal-
changes setup, it seems to me that having to write (e.g.):
    if((var & 1))
rather than:
    if(var & 1)
is no greater hardship than having to write (e.g.):
    while((nextone=getnext()))
rather than:
    while(nextone=getnext())
as you already have to do to avoid warnings in gcc (when
used with suitably high warning-level).


And if you think the worst problem with Java is the
need to express such an idiom with the variant:
    if((var&1)!=0)
then I have a very interesting bridge to sell you!-)


Alex






More information about the Python-list mailing list