630
fixed rule (lemmy.blahaj.zone)
submitted 1 year ago by ambrosiaforest to c/196
you are viewing a single comment's thread
view the rest of the comments
[-] strepto@kbin.social 13 points 1 year ago
[-] p1mrx@sh.itjust.works 2 points 1 year ago* (last edited 1 year ago)

GNU style is logical, because braces are syntactically a single statement:

while (x == y)
  func1();  // can be replaced by { ... }

However, I prefer to entirely avoid unbraced single statements after while/if:

while (x == y) {
  func1();  // easy to add func2(); later
}

Although this is ok when it fits:

while (x == y) func1();  // brevity!
this post was submitted on 10 Feb 2024
630 points (100.0% liked)

196

17022 readers
671 users here now

Be sure to follow the rule before you head out.

Rule: You must post before you leave.

^other^ ^rules^

If you have any questions, feel free to contact us on our matrix channel.

founded 2 years ago
MODERATORS