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 9017919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:23:28+00:00 2026-06-16T04:23:28+00:00

Disclaimer : I know purists on either side, C or C++, will not like

  • 0

Disclaimer: I know purists on either side, C or C++, will not like this. The job needs to get done.

I would like to use as many non-OOP related features of C++ to make my C-like coding (but compiled with a C++ compiler, of course) more enjoyable. The end product should be a C-like library (and an accompanying executable) which is relatively easy to embed in C programs.

What I would terribly need is function overloading, for instance. I guess the client code (written in C) could use libffi or similar to get the mangled named, so the functions can be called.

Other nice features would be default values and perhaps templates.

I wouldn’t use any C++ library (only C), no exceptions, no RTTI, and no objects.

  1. What is the complete list of C++ features which are not in C, which I could use under these restrictions, and what are some common libraries and techniques to make it work as painlessly as possible?
  2. What should I pay attention to?

I know about the related question, but as I’ve said, I don’t want any glue code (perhaps with the exception of the mangling part, which the client would have to do if he doesn’t use C++), and I wouldn’t use any OOP features. I am ready to make compromises.

  • 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-06-16T04:23:29+00:00Added an answer on June 16, 2026 at 4:23 am

    I’ll get downvoted a lot for this, because this doesn’t really answer the question, but…

    • If you want to be called portably from the outside, use C prototypes. No overloading, no default arguments, no templates, no C++ types. Only C types, ie. integers, floating point numbers and pointers (pointers to opaque incomplete C++ structures are OK). Requiring a client library to use libffi or similar is asking for trouble.
    • If you want to use C++ features and libraries, you can use them and still comply with the above with a little work (don’t forget extern "C", and catch all exceptions).

    If the client is not willing to use C++ (which is perfectly understandable), you’ll have to write glue code anyway. The only solution to minimize glue code is to design a clean API.

    It is possible to write the “top layer” (close to the externally visible API) in a way that will require almost no glue, and use C++ for the internals.

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

Sidebar

Related Questions

I will preface this question with the disclaimer that I know there are many
DISCLAIMER: The following code is not something I would ever use in a real
Disclaimer: not sure this is WordPress related or not. I'm following a simple tutorial
The Disclaimer First of all, I know this question (or close variations) have been
Disclaimer: I know there are quite a few questions out there with this topic
Disclaimer Yes, I know: don't use PASSWORD(password) to encrypt passwords . I don't want
Disclaimer: The site has meanwhile been updated, this issue does not occur anymore with
Disclaimer: I know this is a bad way to do things. It is the
I know that there is code like this: http://www.java2s.com/Code/Android/Security/RSAencryptdecryptfunctionRSAECBPKCS1Padding.htm /* Copyright (c) 2010, Sungjin
Disclaimer: I know this type of question has been asked here before, I just

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.