Skip to content

c89-style data/executable code segregation policy #6971

Open

Description

@badasahog

c89 requires data and executable code to be segregated, similar to assemblers like MASM.

It appears that a lot of code still uses similar patterns (albeit not at the beginning of the function), likely an artifact of an earlier language target before this project was updated to c99.

for example: https://github.com/Rdatatable/data.table/blob/master/src/fread.c#L2241

This can hamper readability, because objects are declared miles away from where they're actually used.

I know some people prefer this older style, so I wanted to get a vote of confidence before I started migrating to c99 syntax.

Activity

  1. MichaelChirico commented on May 13, 2025

    @MichaelChirico
    Member

    What is the proposed change, exactly? Personally I find that function body far too long & would break it up into more helpers. Do you have something different in mind?

  2. badasahog commented on May 13, 2025

    @badasahog
    ContributorAuthor

    I was going to move the object declarations generally closer to where they're actually used.

    This change would also make it easier to extract stuff into helper functions if we choose to do that

  3. MichaelChirico commented on May 13, 2025

    @MichaelChirico
    Member

    I guess the effort would be better spent jumping straight to designing helpers, but if you want to write a PR I will review :)

  4. added
    code-quality
    on Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    code-quality

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions