C&C++ sources compiled as c++ with g++ (mingw)

J

Jose Garcia

Hi...

I am wrinting a win32-aplicattion that not uses classes.
I use stdio.h and iostream for example, and, the operators new & delete
for memory.

Then... Is "licit" to mix c & c++ code, compiled as c++, without OOP ??


Or.. maybe i have to translate to only C code and forget "cout <<",
new, delete, etc... if I not use objectes and classes?

Txs!!
 
J

Jack Klein

Hi...

I am wrinting a win32-aplicattion that not uses classes.
I use stdio.h and iostream for example, and, the operators new & delete
for memory.

iostream does not exist in C. There are no new or delete operators in
C.
Then... Is "licit" to mix c & c++ code, compiled as c++, without OOP ??

Here it is, in comp.lang.c there is no such thing as C++. It is not
part of the C standard, and C does not define any compatibility with
it.
Or.. maybe i have to translate to only C code and forget "cout <<",
new, delete, etc... if I not use objectes and classes?

Txs!!

As far as C is concerned, your C++ program is no different than a
program in FORTRAN or Pascal. The fact that C++ chooses to adopt some
of C's syntax and library is strictly a C++ issue.

If you want opinions about using C functions in a C++ program, the
place to ask is comp.lang.c++.
 
C

Chris Williams

Jose said:
Hi...

I am wrinting a win32-aplicattion that not uses classes.
I use stdio.h and iostream for example, and, the operators new & delete
for memory.

Then... Is "licit" to mix c & c++ code, compiled as c++, without OOP
??

What do you mean by "licit"?

lic·it (lis'it)
adj.
Permitted by law; legal.

I can guarantee that even though you mix your languages, you will not
go to jail.
If you are asking whether or not you will be able to call the windows
API (which was written for C), then yes you will be fine. C++ can use
things that were written in C.
If you want to switch to a compiler that cannot compile C++ then you
will have to change to malloc and printf only.

Just a note: Taking the time to spell "Thanks" makes responders feel
like you care about getting an answer. If this was a chat session and
you were a slow typer then using shorthand is fine, but for an official
request for help, many consider this rude. You're better off if you
don't get in the habit even though it has become fairly commonplace
among felow young haxx0rs.

-Chris (25, male, haxx0r, l33t)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,152
Latest member
LorettaGur
Top