Skip to content

Missing Example in C Naming Conventions #15

Description

@PaulTreitel

The second-to-last paragraph in the C Style Guide Naming Conventions refers to missing examples of why loop variables shouldn't always be one letter. An adaptation of the Python examples might be:

No:

for {int x = 0; x < data_len; x++) {
    // ...
    // 10 lines of code
    // ...
    float y = m / 60;
    // ...
    // 50 lines of code
    // ...
    data[x] += y
}

Yes:

for {int student_index = 0; x < data_len; x++) {
    // ...
    // 10 lines of code
    // ...
    float hours_worked = m / 60;
    // ...
    // 50 lines of code
    // ...
    data[student_index] += hours_worked;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions