This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Characters per line: from punch card (80) to line printer (132)


On Thu, Dec 05, 2019 at 11:54:04AM -0700, Martin Sebor wrote:
> >>		      if (present)
> >>			ptr
> >>			  = gfc_build_conditional_assign_expr (block, 
> >>			  present,
> >>							       ptr, nullarg);
> 
> The snippet of code above looks like it might be the symptom
> of another common problem: deeply nested conditionals, case
> statements, or loops in very large functions.  Those usually
> make it much harder to follow code than local variables or
> expressions that are broken up to fit the width limit.
> Shorter functions typically also means fewer local variables.

Yes, and you only get problems that you do not know which var is which,
or you do not know what value it is set to because it was set some 2800
(or 40 or whatever) lines ago, in WAY too long functions.

All those problems do not exist in well-factored code.  The point is not
to have short routines: the point is to not have too much (external)
complexity per routine.  A routine should ideally only do one thing, and
its name should describe what it does.


Segher


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]