Anonymous
Alexander "SonnySlave"
Pepe 🐸
Тогда формулировка говно на cppreference
очевидно что no initialization is performed относится к ручной инициализации, а дефолт инициализация это очевидно рантайм, так что нормальная формулировка
Evgenii
🍻
Evgenii
Success : Ubuntu 17.10 x86_64 on LLVM/clang-built kernel with LLVM/clang-built Nvidia 390.25 driver http://lists.llvm.org/pipermail/llvm-dev/2018-March/121810.html
Alexander "SonnySlave"
Alexander "SonnySlave"
А default initialization это не про явную инициализацию точно
Danil
Anonymous
🐙 Antony
Evgenii
Berkus
🦥Alex Fails
Cuno
reinterpret_cast из T1 в T2 UB при sizeof(T2) > sizeof(T1)?
Constantine
reinterpret_cast не UB никогда
Constantine
вот читать не тот тип UB
Cuno
Ну понятно, что само по себе оно ничего не ломает потому что ни во что не компилируется.
Constantine
ну поставьте нормальный вопрос
Cuno
Окей, ставлю: использование результата каста выше - UB?
Constantine
Whenever an attempt is made to read or modify the stored value of an object of type DynamicType through a glvalue of type AliasedType, the behavior is undefined unless one of the following is true:
AliasedType and DynamicType are similar.
AliasedType is the (possibly cv-qualified) signed or unsigned variant of DynamicType.
AliasedType is std::byte, (since C++17)char, or unsigned char: this permits examination of the object representation of any object as an array of bytes.
Informally, two types are similar if, after stripping away cv-qualifications at every level (but excluding anything inside a function type), they are the same type. For example:
Constantine
http://en.cppreference.com/w/cpp/language/reinterpret_cast
Berkus
Ну то есть не уб только если ты напишешь перед кастом static_assert(sizeof(aaa)==sizeof(int));
Berkus
Ну или не сделаешь енум явно специфицированным классом enum class aaa : int
Constantine
Constantine
> An expression of integral, enumeration, pointer, or pointer-to-member type can be converted to its own type. The resulting value is the same as the value of expression. (since C++11)
Berkus
To its own type
Constantine
там есть отдельное правило, но непонятно, зачем enum на underlying type кастить через reinterpret
Berkus
Есть std::underlying_type ващет
Constantine
static_cast
Scoped enumeration type can be converted to an integer or floating-point type. When the target type is cv bool, the result is false if the original value is zero and true for all other values. For the remaining integral types, the result is the value of the enum if it can be represented by the target type and unspecified otherwise. (since C++11)
Constantine
Any pointer to object of type T1 can be converted to pointer to object of another type cv T2. This is exactly equivalent to static_cast<cv T2*😠static_cast<cv void*😠expression)) (which implies that if T2's alignment requirement is not stricter than T1's, the value of the pointer does not change and conversion of the resulting pointer back to its original type yields the original value). In any case, the resulting pointer may only be dereferenced safely if allowed by the type aliasing rules (see below)
Constantine
ого!
Constantine
я не знал, что T1 -> T2 -> T1 в reinterpret_cast НЕ ГАРАНТИРУЕТСЯ если alignof(T2) > alignof(T1)
Egor
Danil
гцц капец?
как только у LLVM будет такая же широкая поддержка всех платформ
Egor
архитектур?
Danil
Egor
🐙 Antony
Новая шикарная задачка для собеседований!
Найдите ошибку:
future<string> concat(const std::string& prefix, future<string> suffix) {
co_return (prefix + co_await suffix);
}
Egor
префикс может удалиться?
🐙 Antony
ты знал?!
Egor
предположил
Pepe 🐸
🐙 Antony
vladislav
Pepe 🐸
Co(n)stantine👨🔬
Co(n)stantine👨🔬
ааа
Co(n)stantine👨🔬
что значит coroutines TS
🐙 Antony
Техническая спцификация по Сопрограммам. Возможность поиграться с ними до того, ка кони попадут в стандарт
Co(n)stantine👨🔬
где документация по этим корутинам? на cppreference нету
Andrei
насколько знаю, они пока только у VS реализованы
Evgenii
Co(n)stantine👨🔬
🤔
Co(n)stantine👨🔬
спасибо
Kirill
вот ссылка на сам тс
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/n4723.pdf
Kirill
ну собственно да
Berkus
https://clang.llvm.org/cxx_status.html#ts coroutines ts fully impl'd
Berkus
-fcoroutines-ts
Co(n)stantine👨🔬
в гцц не завезли?
Berkus
может и завезли, но у них сайт ебанутый, не знаю где там искать статус
Berkus
погугли
Berkus
по идее это самая простая фича, должны были сделать
Igor
а где можно почитать про корутины для чайников, с примерами? все статьи и доклады с цппкона что я пока находил, как-то пролетали мимо мозга не могя в нём закрепиться(
Co(n)stantine👨🔬
Co(n)stantine👨🔬
ну вот в тс есть примеры
Berkus
Berkus
ну для базы пойдет, а детали конечно будут несколько другие, т.к. модель памяти не такая
Berkus
пока изучишь как раз и доки на ТС завезут)
Egor
в многих примерах по co_* начинают писать какие-то генераторы
Anonymous
alex kos, ты сюда за зависимыми тпипами?
alex
Не только)
alex
в гцц не завезли?
Насколько я знаю, нет. https://gcc.gnu.org/ml/gcc/2018-01/msg00030.html