Berkus
ага, присылай линку как зашлешь
Roman
да, он генерит два символа foo<10>
Roman
т.е. два типа с одинаковым именем, но внутри одно signed, другого unsigned
Berkus
ага, это может быть косяк кодогенератора либо какая-то проблема в спеке DWARF
Berkus
в любом случае неплохо уточнить у специалистов что они думают
🦥Alex Fails
Чат, предлагаю поржать над вот этой замечательной статьей: https://proglib.io/p/tricky-challenges-cpp/
Найдите 10 ошибок.
Egor
Прям 10?
Меня пока только смутил вызов`f()` вне кода функции.
🦥Alex Fails
там их больше -_-
Vsevolod
"каверзные" вопросы без темплейтов, фи
🦥Alex Fails
это каверзные вопросы на должность стажёра стажёра
Ioann_
Alexander "SonnySlave"
вообще нет смысла в каверзных вопросах
Alexander "SonnySlave"
только для повышения ЧСВ
Ioann_
Соглашусь
🦥Alex Fails
VaNyA
Вопрос, на C++ пишут ботов или используют другие ЯП?
🦥Alex Fails
пишут
🦥Alex Fails
кто мешает-то (кроме некомпетентности и (или) лени)
VaNyA
Спасибо
Anonymous
🦥Alex Fails
CPR тебе с избытком хватит для ужасно простого REST API ботов
Anonymous
🦥Alex Fails
🤷♂️ ну тут ты просто делаешь свои классцы, сериализуемые в запросы, и не паришь мозг. Или вообще тупо делаешь процедуры с параметрами
VaNyA
А что нужно для создание бота на C++ в discord?
Anonymous
А тебе точно C++ надо?
🦥Alex Fails
🦥Alex Fails
но ее автор не уверен, что тебе точно надо C++
Alexander "SonnySlave"
Alexander "SonnySlave"
пожалей людей
VaNyA
А вообще почему C++ не используют для ботов?
Alexander "SonnySlave"
Дмитрий
Вообще. Можно глянуть в github, с пометкой "discord api".
Валерчик
Можете посоветовать хорошую книгу про C++? Заранее спасибо.
Alexander "SonnySlave"
Anonymous
Anonymous
Что с телеграм бот апи, что с дискордом.
Anonymous
Ибо не для тех целей C++ сделан.
Валерчик
@supapro
Что это за чат? Тут спросить?
Alexander "SonnySlave"
Валерчик
Ладно спрошу, спасибо.
Дмитрий
Я не говорю что там прям всё так круто. Я предпочёл бы для бота больше питон. Но если человека интересует c++ бот. То. Там есть возможность найти небольшие попытки.
🦥Alex Fails
да один хрен, на чем логику писать
🦥Alex Fails
тут главное не язык, а способность проектировать и выражать свои мысли на языке
Andrii
У меня есть класс А, который хранит в себе указатель на класс B. Конструктор класса А выглядит примерно вот-так:
A(B *b): b_pointer(b) {}
Однако компилятор выдает ошибку, мол у класса В нет подходящего конструктора B(). Но я ведь инициализирую не сам объект класса В, а указатель на него. В чем проблема?
Ioann_
А у тебя объект B создается где через new ? Или это смарт поинтер ?
Andrii
через new
Ioann_
Ну то есть, ты пишешь так:
A a(new B) ?
Andrii
да
Ioann_
Ну вот он тебе и пишет что конструктора у тебя нету подходящего.
Ioann_
Можешь использовать malloc, например
Ioann_
Они ctor не вызывают
Ioann_
Ну или operator new, тот что обычно перед placement используют. Так точнее его обозвать.
Vitaliy ◀️TriΔng3l▶️
Andrii
Vitaliy ◀️TriΔng3l▶️
а, прочитал, в чём проблема
Alexey
Alexey
а то мы тут еще долго гадать будем.
Andrii
всем спасибо, проблема уже обнаружилась
Alexey
на godbolt например, где проблема воспроизводилась бы
Anonymous
Что-нибудь игрушечное, вроде Python или Go.
Alexey
или похардкорней: D, Rust.
Alexander
Alexey
забавная ошибка: "unsigned char, он пересматривается по 8-битному значению".
char же совсем не обязательно 8 бит.
Alexander
Каверзные вопросы эпохи c++03
Такие можно задавать по приколу если кандидат не подходит, а ты на собеседовании сидишь и думаешь как бы время потянуть
Matwey
char как зеленые человечки. все говорят, что он не 8 бит, но почти никто такого не видал
Berkus
он НЕ МЕНЬШЕ 8 бит
Berkus
в DSP чары по 24 бита вполне себе норма
🦥Alex Fails
32-битный чар еще есть в некоторых DSP от техасовцев (емнип)
Matwey
DSP это все-таки не процессор общего назначения, на нем нет смысла запускать подавляющее большинство наших обычных программ и наоборот. Поэтому это какой-то неубедительный аргумент.
Alexey
https://wandbox.org/permlink/nbrYvBOxLazfvFvY
https://wandbox.org/permlink/notglrnlWxTJMntu
Случайно обнаружил такой баг gcc(по стандарту кланг ведет себя правильно, а gcc нет).
Это известная бага или надо какой-то багрепорт писать?
Berkus
Matwey
Berkus
я такого не видел )
Anton
Alexey
X takes a template template parameter[1], meaning that any template argument for X needs to itself take a template parameter. For instance, you cannot do X<int>, but you can do X<Y>, since Y itself is a template. There are two definitions of X, first the general template one, then the specialization X<Y>.
Y is a normal template.
Z is a template alias declaration, meaning that Z is now an alias for Y (think of template aliases as a "typedef for templates").
Now let's look at main():
Defining a variable of type X<Y> uses that specialization (printing 2). But what happens when we use a template alias, as in X<Z>? Is the specialization X<Y> still used, since Z is an alias for Y?
No. According to §14.5.7¶1 in the standard, a template alias declaration resolve to a new family of types. The specialization cannot be used, and the first template delcaration is used instead, printing 1.
[1]: For a good introduction to template template parameters, s
Anton
X takes a template template parameter[1], meaning that any template argument for X needs to itself take a template parameter. For instance, you cannot do X<int>, but you can do X<Y>, since Y itself is a template. There are two definitions of X, first the general template one, then the specialization X<Y>.
Y is a normal template.
Z is a template alias declaration, meaning that Z is now an alias for Y (think of template aliases as a "typedef for templates").
Now let's look at main():
Defining a variable of type X<Y> uses that specialization (printing 2). But what happens when we use a template alias, as in X<Z>? Is the specialization X<Y> still used, since Z is an alias for Y?
No. According to §14.5.7¶1 in the standard, a template alias declaration resolve to a new family of types. The specialization cannot be used, and the first template delcaration is used instead, printing 1.
[1]: For a good introduction to template template parameters, s
Спасибо, я поразбираюсь сегодня ночью
Anton
X takes a template template parameter[1], meaning that any template argument for X needs to itself take a template parameter. For instance, you cannot do X<int>, but you can do X<Y>, since Y itself is a template. There are two definitions of X, first the general template one, then the specialization X<Y>.
Y is a normal template.
Z is a template alias declaration, meaning that Z is now an alias for Y (think of template aliases as a "typedef for templates").
Now let's look at main():
Defining a variable of type X<Y> uses that specialization (printing 2). But what happens when we use a template alias, as in X<Z>? Is the specialization X<Y> still used, since Z is an alias for Y?
No. According to §14.5.7¶1 in the standard, a template alias declaration resolve to a new family of types. The specialization cannot be used, and the first template delcaration is used instead, printing 1.
[1]: For a good introduction to template template parameters, s
Нет, все-таки это баг кланга https://bugs.llvm.org/show_bug.cgi?id=26093