База ответов ИНТУИТ

Программирование на С/С++

<<- Назад к вопросам

К каким действиям препроцессора приводит использование директивы #include?

(Ответ считается верным, если отмечены все правильные варианты ответов.)

Варианты ответа
препроцессор находит в файловой системе файл, имя которого задано в директиве(Верный ответ)
препроцессор удаляет директиву(Верный ответ)
препроцессор игнорирует директивы #include, которые встречает в включаемом файле
препроцессор вставляет содержимое включаемого файла в то место, где была директива(Верный ответ)
Похожие вопросы
Какие функции выполняют директивы препроцессора языка С?
Какие директивы препроцессора необходимы при организации условной компиляции программ на языке С?
<pre> //====================== start of sample.cpp ========================== #include &lt;climits&gt; #include &lt;limits&gt; #include &lt;boost/static_assert.hpp&gt; namespace name { BOOST_STATIC_ASSERT(std::numeric_limits&lt;int&gt;::digits == 32); } int main(int argc, char* argv[]) { return 0; } //====================== end of sample.cpp ========================== </pre> Что случится c программой из файла sample.cpp если в системе размер int больше 32 разрядов?
<pre> //====================== start of sample.cpp ========================== #include &lt;string&gt; #include &lt;type_traits&gt; struct my_string { std::string s; my_string(const std::string&amp; s); }; int main(int argc, char* argv[]) { is_copy_constructible&lt;my_string&gt;; return 0; } //====================== end of sample.cpp ========================== </pre> Каким образом можно проверить требование CopyConstructable посредством шаблона стандартной библиотеки is_copy_constructible для типа my_string из файла sample.cpp?
Какие утверждения о директивах препроцессора языка С верны?
Какие функции и особенности директив препроцессора #define - #undef указаны верно?
К каким последствиям приведёт использование ключевого слова extern при описании переменной, находящейся внутри тела функции?
<pre> //====================== start of sample.cpp ========================== #include &lt;boost/shared_ptr.hpp&gt; #include &lt;boost/scoped_ptr.hpp&gt; #include &lt;boost/weak_ptr.hpp&gt; #include &lt;vector&gt; struct A { virtual ~A(); }; struct B: public A {}; struct C {}; void foo1(boost::scoped_ptr&lt;A&gt; a); void foo2(boost::scoped_ptr&lt;B&gt;&amp; a); void foo3(boost::shared_ptr&lt;C&gt; a); void foo4(boost::scoped_ptr&lt;A&gt;* a); void foo5(std::vector&lt; boost::scoped_ptr&lt;C&gt; &gt;&amp; c); int main(int argc, char* argv[]) { boost::scoped_ptr&lt;A&gt; b1(new A); boost::scoped_ptr&lt;B&gt; b2(new B); boost::scoped_ptr&lt;C&gt; b3(new C); boost::scoped_ptr&lt;A&gt; b4; std::vector&lt; boost::scoped_ptr&lt;C&gt; &gt; v1; v1.push_back(b3); foo1(b1); foo2(b2); foo3(b3.lock()); foo4(&amp;b4); foo5(v1); return 0; } //====================== end of sample.cpp ========================== </pre> В каких из функциях умный указатель boost::scoped_ptr используется правильно?
<pre> //====================== start of sample.cpp ========================== #include &lt;boost/shared_ptr.hpp&gt; #include &lt;boost/scoped_ptr.hpp&gt; #include &lt;boost/weak_ptr.hpp&gt; #include &lt;vector&gt; struct A { virtual ~A(); }; struct B: public A {}; struct C {}; void foo1(boost::shared_ptr&lt;A&gt; a); void foo2(boost::weak_ptr&lt;B&gt;&amp; a); void foo3(boost::shared_ptr&lt;C&gt; a); void foo4(boost::scoped_ptr&lt;A&gt;&amp; a); void foo5(std::vector&lt; boost::weak_ptr&lt;C&gt; &gt;&amp; c); int main(int argc, char* argv[]) { boost::shared_ptr&lt;A&gt; a(new A); boost::shared_ptr&lt;B&gt; b(new B); boost::shared_ptr&lt;C&gt; c(new C); boost::weak_ptr&lt;A&gt; b1(a); boost::weak_ptr&lt;B&gt; b2(b); boost::weak_ptr&lt;C&gt; b3(c); std::vector&lt; boost::weak_ptr&lt;C&gt; &gt; v1; v1.push_back(b3); foo1(b2.lock()); foo2(b2); try { boost::shared_ptr&lt;C&gt; c1(c); foo3(c1); } catch(boost::bad_weak_ptr&amp; e) { } foo4(b2.lock()); foo5(v1); return 0; } //====================== end of sample.cpp ========================== </pre> Вызовы каких функций выполнены корректно и операции создания их параметров не содержат очевидных проблем?
<pre>//====================== start of sample.cpp ========================== #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;vector&gt; class ServiceOrganization; class BuildingElement { static char* m_city; std::vector&lt;int&gt; m_flats; unsigned int m_square; ServiceOrganization& m_organization; FILE *m_document; BuildingElement* m_pNext; public: BuildingElement(); BuildingElement(BuildingElement&amp;&amp; src) : m_square(0) , m_organization(src.m_organization) , m_document(src.m_document) , m_pNext(src.m_pNext) { m_flats = src.m_flats; src.m_flats.clear(); src.m_organization = ServiceOrganization(); ::fclose(src.m_document); src.m_document = NULL; ::free(src.m_pNext); src.m_pNext = NULL; } };//====================== end of sample.cpp ========================== </pre> Какие операции, выполняемые в конструкторе переноса в файле sample.cpp являются лишними?