С++ для интервью
37 subscribers
10 photos
Готовься к собеседованиям по C++ эффективно: реальные вопросы, типичные HR уловки, примеры кода и объяснения.
Каждый пост — один шаг ближе к офферу 💼
Download Telegram
⚙️ Использование mutable
struct S {
mutable int x;
void f() const { ++x; }
};
🔥4👍1
🔍 explicit конструктор
struct A {
explicit A(int);
};
A a = 5;
Please open Telegram to view this post
VIEW IN TELEGRAM
🔥5❤3👍2
Код выше корректный?
Anonymous Quiz
33%
Да
50%
Нет
17%
Только с C++20 и выше
🔥5👍4🥰2
Когда вычисляется ветка if constexpr?
Anonymous Quiz
27%
runtime
45%
compile time
27%
link time
🔥8👍5🥰2
👍10🔥10❤5🥰2
🎯 Lifetime extension
const int& r = 10;
🔥21❤18👍4
👍21❤15🔥10🥰2
🔍 Dangling pointer
int* f() {
int x = 5;
return &x;
}
Please open Telegram to view this post
VIEW IN TELEGRAM
🗂 Размер пустой структуры
struct A {};
std::cout << sizeof(A);
Please open Telegram to view this post
VIEW IN TELEGRAM
🖥 Empty Base Optimization
struct E {};
struct A : E {
int x;
};
Please open Telegram to view this post
VIEW IN TELEGRAM
😉 const после функции
struct A {
int f() const;
};
Please open Telegram to view this post
VIEW IN TELEGRAM
Гарантирует ли std::atomic<> ordering?
Anonymous Quiz
25%
Нет
25%
Да
50%
Зависит от операции