A
A
Anarbek Balmukanov2015-05-27 21:21:29
C++ / C#
Anarbek Balmukanov, 2015-05-27 21:21:29

How do macros work in c?

Good time of the day.
I am using c without the standard library. But __DATE__ works for some reason. Explain how macros are implemented please and where to see their implementation.
ps code is executed at the hardware and bios levels. So it became interesting to me, it turns out that __DATE__ takes the date from bios? I can't figure it out myself in the compiler sources

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Andrey Burov, 2015-05-27
@Anarbek

www.opennet.ru/docs/RUS/cpp/cpp-5.html

'__DATE__'
This macro is replaced with a string constant that specifies the start date of the preprocessor. This constant is eleven characters long and looks something like '"Jan 29 1987"' or '"Apr 1 1905"'.

M
mamkaololosha, 2015-05-27
@mamkaololosha

Google compilation steps. In particular - the preprocessor
https://en.wikipedia.org/wiki/C_preprocessor

M
MiiNiPaa, 2015-05-27
@MiiNiPaa

__DATE__, __LINE__ and the like are substituted by the preprocessor itself. The implementation can be viewed only by downloading the source code of the compiler.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question