Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rfc7: amend C style recommendations #435

Merged
merged 3 commits into from
Dec 2, 2024

Conversation

garlick
Copy link
Member

@garlick garlick commented Dec 2, 2024

Problem: we have organically adopted some project norms for C code that are not documented.

Update RFC 7.

Problem: the C section has subsections but the original whitespace
oriented content is not in a subsection.

Create a "whitespace" subsection.
Problem: we've adopted a defacto guideline that long parameter lists
should be broken to one per line but it is not documented.

Add this to RFC 7.
Problem: we have internalized an expectation that functions do not
have side effects on error, but this is undocumented.

Add this to RFC 7.
Copy link
Contributor

@grondo grondo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@mergify mergify bot merged commit 0423b90 into flux-framework:master Dec 2, 2024
7 checks passed
@garlick garlick deleted the rfc7_update branch December 2, 2024 17:34
Comment on lines +70 to +87
9. Long parameter lists in function declarations or calls SHOULD be broken
to one parameter per line, at the same indent level. Example:

.. code-block:: c

flux_future_t *flux_rpc (flux_t *h,
const char *topic,
const char *s,
uint32_t nodeid,
int flags);

.. code-block:: c

f = flux_rpc (h,
"service.do-something",
NULL,
FLUX_NODEID_ANY,
FLUX_RPC_RESPONSE);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

little late to the party no this, but do we also want to add a similar thing for complex branch statements? i.e

if (foobar == 1
    || boobar > something
    || cow < 123434343)
    ...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we should!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hehe, ok i'll write up an attempt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants