На главную Наши проекты:
Журнал   ·   Discuz!ML   ·   Wiki   ·   DRKB   ·   Помощь проекту
ПРАВИЛА FAQ Помощь Участники Календарь Избранное RSS
msm.ru
Модераторы: Qraizer, Hsilgos
Страницы: (78) « Первая ... 38 39 [40] 41 42 ...  77 78  ( Перейти к последнему сообщению )  
> Текущий Стандарт С++ и перспективы его развития
    нет, не забыл :(
    P.S. Хотел предложить кидать сюда статьи по новому стандарту. (Попалась одна интересная статейка про потоки). И тут я прочитал подпись: niXman (try-catch) ;)
    Спасибо за статью :thanks:
      по поводу std::thread - это системнозависимо. полагаю, что для того чтоб это работало в mingw, нужно что-то специфическое конфигурировать. или попытаться собрать используя pthread-win32. не знаю точно.. нужно пробовать..

      Добавлено
      хотя в линуксе это работает..
        Похоже странная солянка у меня получилась из MinGW с sourceforge и mingw от niXman.
        Ибо у меня в папке lib есть libpthread.dll.a
        Есть ещё флаг компилятору: -lpthread, так вот компиль на него не ругается, но и ошибки теже - не знает он про thread.
          std::thread под MinGW не работает. Не допилили ещё..

          Добавлено
          Могу скинуть допиленый, но не официальный. Работает только сам thread и mutex.
            Цитата Повстанець @
            Могу скинуть допиленый, но не официальный.

            валяй, побалуюсь, пока время есть
            если на почту - то alekseyl <а> list <d> ru
              папку include записывать в gcc_path\lib\gcc\mingw32\номер_версии\
              Исходники просто подключи к проекту.
              Компилить с флагами
              -D_POSIX_TIMEOUTS
              -D_GLIBCXX__PTHREADS
              -D_GLIBCXX_HAS_GTHREADS

              Прикреплённый файлПрикреплённый файлthread.zip (9,03 Кбайт, скачиваний: 131)
                мдам-с, теперь он ругается на _GLIBCXX_BEGIN_NAMESPACE(std) в error_constants.h
                и ещё куча связанных ошибок:
                Скрытый текст

                Цитата

                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\bits\error_constants.h|37|error: expected constructor, destructor, or type conversion before '(' token|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\bits\error_constants.h|123|error: '_GLIBCXX_END_NAMESPACE' does not name a type|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\system_error|61|error: 'errc' was not declared in this scope|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\system_error|61|error: template argument 1 is invalid|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\system_error|109|error: variable 'std::error_code std::make_error_code' has initializer but incomplete type|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\system_error|109|error: 'errc' was not declared in this scope|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\system_error|173|error: 'std::make_error_code' declared as an 'inline' variable|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\system_error|173|error: 'errc' was not declared in this scope|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\system_error|189|error: variable 'std::error_condition std::make_error_condition' has initializer but incomplete type|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\system_error|189|error: 'errc' was not declared in this scope|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\system_error|247|error: 'std::make_error_condition' declared as an 'inline' variable|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\system_error|247|error: 'errc' was not declared in this scope|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\system_error|308|error: expected class-name before '{' token|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\system_error||In constructor 'std::system_error::system_error(std::error_code)':|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\system_error|314|error: class 'std::system_error' does not have any field named 'runtime_error'|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\system_error||In constructor 'std::system_error::system_error(std::error_code, const string&)':|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\system_error|317|error: class 'std::system_error' does not have any field named 'runtime_error'|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\system_error||In constructor 'std::system_error::system_error(int, const std::error_category&)':|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\system_error|331|error: class 'std::system_error' does not have any field named 'runtime_error'|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\system_error||In constructor 'std::system_error::system_error(int, const std::error_category&, const string&)':|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\system_error|335|error: class 'std::system_error' does not have any field named 'runtime_error'|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\mutex||In member function 'void std::unique_lock<_Mutex>::lock()':|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\mutex|537|error: 'errc' was not declared in this scope|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\mutex|539|error: 'errc' was not declared in this scope|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\mutex||In member function 'bool std::unique_lock<_Mutex>::try_lock()':|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\mutex|551|error: 'errc' was not declared in this scope|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\mutex|553|error: 'errc' was not declared in this scope|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\mutex||In member function 'bool std::unique_lock<_Mutex>::try_lock_until(const std::chrono::time_point<_Clock, _Duration>&)':|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\mutex|566|error: 'errc' was not declared in this scope|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\mutex|568|error: 'errc' was not declared in this scope|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\mutex||In member function 'bool std::unique_lock<_Mutex>::try_lock_for(const std::chrono::duration<_Rep, _Period>&)':|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\mutex|581|error: 'errc' was not declared in this scope|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\mutex|583|error: 'errc' was not declared in this scope|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\mutex||In member function 'void std::unique_lock<_Mutex>::unlock()':|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\mutex|595|error: 'errc' was not declared in this scope|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\thread||In member function 'std::size_t std::hash<std::thread::id>::operator()(const std::thread::id&) const':|
                d:\program files\codeblocks\mingw\bin\..\lib\gcc\i686-pc-mingw32\4.6.0\..\..\..\..\include\c++\4.6.0\thread|241|error: 'std::_Fnv_hash' has not been declared|
                ||=== Build finished: 27 errors, 0 warnings ===|


                *.cc правда в проект не подключал.
                Но ошибка-то в объявлении
                Edit: добавил, ошибок стало больше. но первые 27 - те же.
                Сообщение отредактировано: Алексей_Л -
                  Не работают alias'ы:
                  ExpandedWrap disabled
                    using MyFloat = float;

                  Если их быть и не должно, то просьба подредактировать первый пост.

                  Кстати в шарпе со списками инициализации лучше сделано там можно инициализировать по именам:
                  ExpandedWrap disabled
                        class Program
                        {
                            static void Main(string[] args)
                            {
                                CTest Test = new CTest{C = '0'};
                            }
                        }
                     
                        class CTest
                        {
                            public int A;
                            public char C;
                        }

                  Но тут вспоминается, что public - это зло...
                  Дело в том, что в шарпе есть свойства.
                  Отсюда вопрос: а есть/будут ли они и в новом C++?
                    Цитата Алексей_Л @
                    Отсюда вопрос: а есть/будут ли они и в новом C++?

                    Нет.

                    Добавлено
                    Цитата Алексей_Л @
                    Не работают alias'ы:

                    Так их поддержка в gcc пока и не заявлена.
                      Цитата Повстанець @
                      папку include записывать в gcc_path\lib\gcc\mingw32\номер_версии\
                      Исходники просто подключи к проекту.
                      Компилить с флагами
                      -D_POSIX_TIMEOUTS
                      -D_GLIBCXX__PTHREADS
                      -D_GLIBCXX_HAS_GTHREADS

                      походу, взято отсюда: http://lists-archives.org/mingw-users/18686-pthreads-recipe-for-using-std-thread-with-mingw-mingw32-mingw-w64.html

                      но это изврат, IMHO.

                      полазав по хидерам mingw обнаружил, что для WIN32 есть реализация, но она что-то не работает. нужно всерьез заняться изучением этого момента, но пока некогда.

                      с другой стороны, можно и не использовать WIN32 реализацию, а использовать имеющуюся и рабочую реализацию для POSIX. в этом случае, нужно понять что сделать, чтоб использовать pthreads-win32.

                      Добавлено
                      касательно thread-библиотеки, можно почитать тут: http://www.mail-archive.com/mingw-w64-public@lists.sourceforge.net/msg01433.html

                      как оказалось, в исходниках gcc, имеются реализации thread-библиотеки для следующих ОС:
                      Цитата
                      gthr-aix.h
                      gthr-dce.h
                      gthr-gnat.c
                      gthr-gnat.h
                      gthr-lynx.h
                      gthr-mipssde.h
                      gthr-nks.h
                      gthr-posix95.h
                      gthr-posix.c
                      gthr-posix.h
                      gthr-rtems.h
                      gthr-single.h
                      gthr-solaris.h
                      gthr-tpf.h
                      gthr-vxworks.h
                      gthr-win32.h

                      как видно, есть и реализация для win32. но странно то, что в моей сборке этого файла нет. наверняка нужно копаться в опциях configure....
                        C++0x это новый вариант? Чет я слышал что страуструп и ко вроде только недавно приступили к переделке...
                        Хмм... то есть это вариант с++ 2010 года?
                            оказывается Strongly Typed Enums уже реализовали!
                            оно даже работает! 8-)
                            ExpandedWrap disabled
                              #include <iostream>
                               
                              enum: char { e1 };
                              enum: short { e2 };
                              enum: int { e3 };
                              enum: long long { e4 };
                               
                              int main() {
                                 std::cout << sizeof(e1) << std::endl;
                                 std::cout << sizeof(e2) << std::endl;
                                 std::cout << sizeof(e3) << std::endl;
                                 std::cout << sizeof(e4) << std::endl;
                              }

                            http://liveworkspace.org/code/0f385b6f43d17669840d84b31c5c133c
                            дока: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf
                              А кто-нибудь знает:
                              Будет ли полная поддержка C++0x в MSVS2010? Обновка выйдет к нему или скоро уже новая версия будет?
                              Сообщение отредактировано: Алексей_Л -
                                кому интересно: удалось собрать mingw на базе gcc-4.7.0-snapshot c поддержкой потоков и всего что с ними связанно.
                                так же, включает поддержку искаропки Graphite+LTO+OpenMP. и на сколько я смог проверить, даже все работает.
                                тестируем: i686-pc-mingw32-bin-4.7.0-snapshop-20110617-rev-0

                                Добавлено
                                оценить LTO можно по примеру: http://kemiisto.blogspot.com/2010/09/lto.html
                                OpenMP: http://people.sc.fsu.edu/~jburkardt/c_src/open_mp/open_mp.html
                                Сообщение отредактировано: niXman -
                                0 пользователей читают эту тему (0 гостей и 0 скрытых пользователей)
                                0 пользователей:
                                Страницы: (78) « Первая ... 38 39 [40] 41 42 ...  77 78


                                Рейтинг@Mail.ru
                                [ Script execution time: 0,0876 ]   [ 18 queries used ]   [ Generated: 21.06.25, 06:21 GMT ]