N
N
NikitkOS2018-07-29 20:31:25
C++ / C#
NikitkOS, 2018-07-29 20:31:25

Is it allowed to use C functions in C++?

I don't know much yet, so this might be a dumb question. Is it bad form to use functions from C in C++ programs? Are there any downsides to using such functions? I asked this question because I needed to get the current date, but using functions from the C library, the compiler said that using a function / variable could be unsafe and suggested using another one. For a detailed explanation or links to articles (English or Russian), a separate huge thank you.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
C
Codebaker, 2018-07-29
@NikitkOS

You can talk for a long time about bad style or the difference between programming paradigms.
You can holivar, or you can know that no one will ever see 90% of the code.
You can also remember that the author himself called C ++ "C with classes".
So yes, you can.

A
Andrey K, 2018-07-30
@kuftachev

Read about mangling, maybe it's all about it.

L
lega, 2018-07-29
@lega

Yes, you can, there is even a style where C++ does not use C++, only from c.

R
Roman Terekhin, 2018-07-30
@RomaZveR

Although C++ has already gone far from "C to classes", but it is possible, compilers are backwards compatible. Just be careful.

A
al_sh, 2018-08-15
@al_sh

as a first approximation, you use them constantly declaring a static class method

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question