You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd be very curious to know an official opinion on the matter.
The norm (v4) III.2 (Formatting) states: "One instruction per line."
I think the use of the word "instruction" is confusion and perhaps should be "statement"?
return(function_call(), 0); This is one statement (return) containing two expressions.
if (ft_isprint(c) && ft_isdigit(c)) This is also one statement (if) containing two expressions.
if (ft_isprint(c), ft_isdigit(c)) Same again (silly but norm friendly).
My thoughts:
If you only allowed one expression per line there would be riots.
It is still mostly conducive to clean code thanks to the other rules: "One single variable declaration per line" & "Multiple assignments are strictly forbidden."
You could 'abuse' this by stacking lots of comma-seperated expressions in a return (or other) statement but I'd like to think that by doing so your evaluators would encourage you to do better.
Once you wrap your head around the comma operator return (printf("OK\n"), 0); isn't too bad.
Description
Multiple instructions in a
return
don't make an errorExemple
This file is good with the norminette but it shouldn't.
Additional infos
norminette 3.3.55
The text was updated successfully, but these errors were encountered: