tech-kern archive

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

Re: MP-safe /dev/console and /dev/constty



>> Your suggestion of pushing it into a separate function (which
>> presumably would just mean using return instead of break to
>> terminate the code block) strikes me as worth considering in general
>> but a bad idea in this case; there are too many things that would
>> have to be passed down to the function in question.
> Of course, GCC offers nested functions for exactly this, but...

Yes.  I would not expect gcc-specific code to be accepted.

In this case, I see no benefit to using a nested function over one of
the constructs that supports a break-out to a well-defined point:
do{...}while(0), switch(0){case 0:...}, while(1){...;break;}, or the
like.  (I would say do-while(0) is the closest to a canonical version
of those.)  In some cases there may be a benefit, if you want to break
out of multiple nested constructs.  (In that case I'd actually use
labeled control structure, but that's even less well supported than
gccisms like nested functions.)

However, this is all armchair quarterbacking when we don't know what
mrg disliked about the code as given.  I still think all it really
needs is to be reformatted so the do and the while(0) don't visually
disappear into the containing if-elseif construct.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index