dememax: (Hacker Emblem)
dememax ([personal profile] dememax) wrote2016-09-19 07:04 pm
Entry tags:

cppreference.com - Си++ Вики / "Most Surprising" from "The Grand C++ Error Explosion Competition"

Что-то я пропустил "новость": у Си++ есть теперь свой Вики - http://cppreference.com/
Ну, не сразу, ну, уже давно, ну, ...
Короче, если интересна история сайта:
CppCon 2014: Nate Kohl "cppreference.com: documenting C++ one edit at a time"

В видео есть слайд с одним из победителей "The Grand C++ Error Explosion Competition", категория "Most surprising":
template<class T>class L{L<T*>operator->()};L<int>i=i->
Запустил у себя с gcc 6.2, действительно, поразительный эффект: я устал ждать, очень долго работал компилятор и генерил без остановки вывод:
a.cpp:1:42: error: expected ‘;’ at end of member declaration
template<class T>class L{L<T*>operator->()};L<int>i=i->
^
a.cpp:1:54: error: ‘L<T*> L<T>::operator->() [with T = int]’ is private within this context
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~
a.cpp:1:31: note: declared private here
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~~~~~~~
a.cpp: In instantiation of ‘L<T*> L<T>::operator->() [with T = int]’:
a.cpp:1:54: required from here
a.cpp:1:54: error: ‘L<T*> L<T>::operator->() [with T = int*]’ is private within this context
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~
a.cpp:1:31: note: declared private here
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~~~~~~~
a.cpp:1:54: error: ‘L<T*> L<T>::operator->() [with T = int**]’ is private within this context
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~
a.cpp:1:31: note: declared private here
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~~~~~~~
a.cpp:1:54: error: ‘L<T*> L<T>::operator->() [with T = int***]’ is private within this context
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~
a.cpp:1:31: note: declared private here
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~~~~~~~
a.cpp:1:54: error: ‘L<T*> L<T>::operator->() [with T = int****]’ is private within this context
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~
a.cpp:1:31: note: declared private here
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~~~~~~~
a.cpp:1:54: error: ‘L<T*> L<T>::operator->() [with T = int*****]’ is private within this context
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~
a.cpp:1:31: note: declared private here
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~~~~~~~
a.cpp:1:54: error: ‘L<T*> L<T>::operator->() [with T = int******]’ is private within this context
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~
a.cpp:1:31: note: declared private here
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~~~~~~~
a.cpp:1:54: error: ‘L<T*> L<T>::operator->() [with T = int*******]’ is private within this context
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~

[identity profile] itman.livejournal.com 2016-09-19 06:00 pm (UTC)(link)
Давно пользуюсь этим сайтом, не знал, что это вики.

[identity profile] madf.livejournal.com 2016-09-20 06:07 am (UTC)(link)
Надо же, не думал что есть еще кто-то из C++-ников кто не знает про существование cppreference.com

[identity profile] fatoff.livejournal.com 2016-09-20 06:09 am (UTC)(link)
У меня никогда не было достаточно любопытства изучать курьёзы имплементации языка.
Как-то по ремесленному, важны аспекты реализации стоящей перед нами рабочей задачи.

Re: никогда не было достаточно

[identity profile] fatoff.livejournal.com 2016-09-20 02:58 pm (UTC)(link)
Примерно так, правильный заголовок. Просто на практике с последними стандартами 11/14 внесено столько нового, что хорошо бы достаточно вникнуть в эту сторону луны и ещё успеть задание сделать. А ранее, когда лез программировать на C++, а мне на то пальцем у виска преимущественные окружающие крутили, основной и очень серьёзной проблемой были платформа/фреймворк. То есть, никогда не было достаточного комфорта, чтобы любопытствовать, что же выйдет из лихо закрученной конструкции, как у тебя в заглавном посте.

Кстати, вот с файлами/директориями немало у нас, и у тебя тоже, предполагаю, развлечения в порядке работы. А попробовать TR2 filesystem, часть языка будет? То есть, вот, писателя скрипта для инсталлера с этим реализовал. Или приятное с полезным без буста.

Если и ковырял что-то в исследовательских целях, почти двадцать лет назад, то были... некоторые алгоритмы. В Сети есть один свидетель моего собственного алгоритма сжатия, с которого проку не очень много. Но он уникален, а свидетель знающий предмет.

Шахматы люблю, концепция достаточно бытро была воспринята в детстве.