Liste des Groupes | Revenir à l c |
On 28/02/2025 10:00, Janis Papanagnou wrote:Have your mental margin-bell ding at around 75 characters, and aim to thow a new line as soon a you can?On 27.02.2025 16:47, David Brown wrote:(I'm snipping part of this - I don't think it is really going anywhere, and certainly not anywhere topical for the group!)On 27/02/2025 06:57, Janis Papanagnou wrote:On 26.02.2025 20:56, David Brown wrote:On 26/02/2025 18:13, Janis Papanagnou wrote:
Agreed.Doing too much in>
one line of code makes it hard to understand - regardless of how many
characters it actually uses.
I think we should abandon speaking about it in terms of characters.
>
(I think we agreed that readability is the key, not a hard or softYes.
column limit; typically used number of columns are nonetheless based
on cultural - you may say also technical; still based on cultural -
sensible heuristics. But habits seem to run out of control "lately".)
>
Sure. It is the "artificial" splitting merely to fit some line length rule that is the problem, not splitting in itself.Taking something that is logically one>
operation or expression and artificially splitting it into two (or more)
lines to suit an arbitrary line length limit also makes the code hard to
understand. [...]
This may be the case or not. - That's the whole point; to organize the
code to become clear. - A split may make it even better readable. (But
a _misplaced_ split may make it worse.)
>Splitting is fine here - it is natural and fits the flow of the code.
Is that split in your opinion reducing readability...?
>
if (sscanf (mutations, "r:%u,g:%u,a:%u,d:%u",
&mutation_rates.base,
&mutation_rates.genesis,
&mutation_rates.aging,
&mutation_rates.death
) != 4)
>
or would you prefer it for (better?) readability to be in one line?
>
I might prefer to write it as :
const int matches = sscanf (mutations, "r:%u,g:%u,a:%u,d:%u",
&mutation_rates.base,
&mutation_rates.genesis,
&mutation_rates.aging,
&mutation_rates.death
);
if (matches != 4) {
since the "!= 4" bit looks a bit lonely and out of place in your code. But that is perhaps just splitting hairs :-)
I also have two 24" screens (on this computer), and my eyes are also not as good as they used to be. (In my youth, I used to write my notes on 2mm graph paper - normal lined paper seemed a waste of space to me.)>>Myself I usually operate on a minimum of two physical screens, and>
(with my font setting) each one capable of displaying two 80-column
windows side by side.
That seems small to me.
Do you mean my screen or my default window size setting?
>
I cannot help; I'm used to the two 24" screens that I have, and my age
and health does not allow to regularly use font's below 10pt (or so).
>
I don't go overboard on line length, but I do like to have more room than 80 characters, and I don't like hard limits. One factor in this is that a fair bit of my development is in C++ (on small embedded systems), and namespaces and classes mean that the average full identifier length is a fair amount longer than in C - thus it is natural for lines to be longer.I have no problem with two approximately>
120-column windows side-by-side in my IDE,
This actually explains your preferences; elsethread I wrote about my
observations of people using larger defaults for window sizes, and
specifically that I've observed IDE users to work with larger default
window sizes also regularly don't mind writing code with (even much)
longer lines.
Les messages affichés proviennent d'usenet.