Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7159083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:10:18+00:00 2026-05-28T13:10:18+00:00

We have a large C code base that has been developed over several decades.

  • 0

We have a large C code base that has been developed over several decades. One of the features of the code is a large dependence on function pointers and pseudo inheritance. The idiom (as discussed here) follows like so:

typedef struct twod_ {
    double x, y;
} twod;

typedef struct threed_ {
    twod super;
    double z;
} threed;

threed *point_3d;
twod *point_2d = (twod *)point3d;

At which point point_2d->x and point_3d->x are the same block of memory.

My questions are:

  • Is this idiom still popular in modern production code? (Any recommended open source examples)
  • This code has a requirement for performance — does this idiom help with speed and/or memory usage?
  • The way that it has been implemented (or due to many years of code bloat) it now feels a bit like spaghetti code — generally speaking, is this a problem with the implementation, or the idiom? Or to put it another way, in an ideal world, would 500k LOC with this idiom be quickly understood?

Of course, the adage “if it aint broke, don’t fix it” would be a good one to keep in mind; however, that isn’t really helping us at the moment, so we think we might have to go deeper with refactoring…

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:10:18+00:00Added an answer on May 28, 2026 at 1:10 pm

    I’d say it’s fine, although of course it can be easy to go confused since it becomes rather verbose.

    For me, the flagship open source implementation of “C with classes” is probably GTK+, specifically the gobject module.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My studio has a large codebase that has been developed over 10+ years. The
I have a very large codebase (read: thousands of modules) that has code shared
I have a very large code base that contains extensive unit tests (using CppUnit).
I have taken over a large code base and would like to get an
Over time, the code base I maintain has grown exponentially. We have a variety
I am working on a rather large code base that has a bit of
I have a large code base that resides on a unix server, and for
We have a large code base that makes copious use of the JSON v1
At work we have a very large code-base that we commonly export for a
We have a large code base in MFC and VB. A few applications are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.