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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:02:24+00:00 2026-05-27T15:02:24+00:00

Overview: I’m working with a hobby app. I want my program to be able

  • 0

Overview:

I’m working with a hobby app. I want my program to be able to stick to “plain C”.

For several reasons, I have to use a C++ compiler, and the related programming enviroment program, that supports “Plain C”. And, for the same reasons, I cannot change to antoher compiler.

And, there are some C++ features that I have been coded, unintentionally.

For example, I’m not using namespaces or classes. My current programming job, is not “plain c” or “c++”, and I haven’t used them for some time, so, I may have forgotten which stuff is “plain c” only.

I have browsed in the internet, for “Plain C” examples. I have found that many other developers, have also post mixed “plain c” & “c++” examples, (some of them unintentionally).

I’m using some dynamically allocated structures. I have been using “malloc”, but I rather use “new” instead. I thought that some new standard & compiler versions of “plain c” allowed “new”, but, seems I’m wrong.

Seems that “new” is a “C++” feature, & if I really want to make a only “plain c”, I should use “malloc”.

The reason I want to stick to “plain C”, it’s because I’m working in a cross platform non-gui library / tool.

My current platform is “Windowze”, my Development Enviroments, are:

(1) CodeBlocks (MinGW)

(2) Bloodshed DevCPP

(3) Borland CBuilder 6

Although, my goal is to migrate it to Linux, too , and maybe other platforms, and other (command-line) compilers.

Quick not Tested Example:

#include <stdio.h>
#include <stdlib.h>
#include <strings.h>

struct MyData_T
{
  int  MyInt;
  char MyName[512];
  char *MyCharPtr;
};

typedef
  struct MyData_T *MyData_P;

MyData_P newData(char* AName)
{
  MyData_P Result = null;

  Result = malloc(sizeof(MyData_T));

  strcpy(Result->MyName, AName, strlen(AName));
  // do other stuff with fields

  return Result;
} // MyData_P newData(...)

int main(...)
{
  int ErrorCode = 0;

  MyData_P MyDataVar = newData("John Doe");

  // do more stuff with "MyDataVar";

  free(MyDataVar);

  return ErrorCode;
} // int main(...)

Questions

  1. Where I can get a working “plain c only” compiler for x86 (windowze, linux) ?

  2. Should I stick to use “malloc”, “calloc”, and similar ?

  3. Should I consider to change to “C++” & “new”, instead ?

  4. Is it valid to use “new” & “delete” in a “plain c” application ?

  5. Any other suggestion ?

Thanks.

Disclaimer
Note: I already spent several hours trying not to post the same question, in Stackoverflow, but, none of the previous answers seem clear to me.

  • 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-27T15:02:25+00:00Added an answer on May 27, 2026 at 3:02 pm

    Remember that C and C++ are actually completely different languages. They share some common syntax, but C is a procedural language and C++ is object oriented, so they are different programming paradigms.

    gcc should work just fine as a C compiler. I believe MinGW uses it. It also has flags you can specify to make sure it’s using the right version of C (e.g. C99).

    If you want to stick with C then you simply won’t be able to use new (it’s not part of the C language) but there shouldn’t be any problems with moving to C++ for a shared library, just so long as you put your Object Oriented hat on when you do.

    I’d suggest you just stick with the language you are more comfortable with. The fact that you’re using new suggests that will be C++, but it’s up to you.

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

Sidebar

Related Questions

Overview I want to be able to modify request parameters and content to 3rd
Question Overview: I want to be able to edit an item (a restaurant in
Overview: I have two pages in my program; the main page and the other
Overview: I have a Silverlight 4 app where I am seeing problematic behavior from
Situation overview. We have several projects used in multifunctional system. objectAccessLibrary.dll (multiple versions) dispatcherHandler.dll
Overview: I have an array of 20 byte strings that needs to be stored
Overview I am using CompositeWPF to create an app using C#. This really should
I have a overview page containing a list with some links from which multiple
I want to get an overview of files that are updated in TFS (that
Overview: I have two text boxes at the top of this form for inputting

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.