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

Enforce C99 to improve readability #121

Merged
merged 1 commit into from
Mar 22, 2024
Merged

Enforce C99 to improve readability #121

merged 1 commit into from
Mar 22, 2024

Conversation

jserv
Copy link
Collaborator

@jserv jserv commented Mar 22, 2024

In C99, it is possible to declare variables precisely where they are needed, a feature also present in C++. Variables can also be declared within the control structure of a for loop, a feature introduced in C99:

for (int x = 0; x < 10; x++) {  /* This is permitted starting with C99 */
    ...
}

Line of code count via 'cloc' command:

  • before
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
SUM:                            13           1049            584           7552
-------------------------------------------------------------------------------
  • after
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
SUM:                            13           1046            584           7458
-------------------------------------------------------------------------------

In C99, it is possible to declare variables precisely where they are
needed, a feature also present in C++. Variables can also be declared
within the control structure of a for loop, a feature introduced in C99:

    for (int x = 0; x < 10; x++) {  /* This is permitted starting with C99 */
        ...
    }

Line of code count via 'cloc' command:

[before]
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
SUM:                            13           1049            584           7552
-------------------------------------------------------------------------------

[after]
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
SUM:                            13           1046            584           7458
-------------------------------------------------------------------------------
@jserv jserv merged commit 73ce2ce into master Mar 22, 2024
8 checks passed
@jserv jserv deleted the enforce-c99 branch March 22, 2024 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant