Thread: [Cppcms-users] Compilation errors using gcc 4.5 and c++0x
Brought to you by:
artyom-beilis
From: Stanimir M. <sta...@zo...> - 2010-06-25 11:53:24
|
Hello Artyom, Congratulations for the beta release of CppCms 1.x.x! I am using the new features of gcc 4.4 and --std=c++0x Here are some compile errors from it. [ 1%] Building CXX object booster/CMakeFiles/booster.dir/lib/aio/src/socket.cpp.o In file included from /usr/include/c++/4.4/bits/stl_algobase.h:66, from /usr/include/c++/4.4/bits/char_traits.h:41, from /usr/include/c++/4.4/string:42, from /usr/include/c++/4.4/stdexcept:39, from /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/function.h:11, from /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/aio/socket.h:12, from /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/lib/aio/src/socket.cpp:28: /usr/include/c++/4.4/bits/stl_pair.h: In constructor ‘std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U1 = int, _U2 = int, _T1 = const booster::aio::buffer_impl<char*>::entry*, _T2 = unsigned int]’: /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/aio/buffer.h:34: instantiated from ‘std::pair<const booster::aio::buffer_impl<Pointer>::entry*, unsigned int> booster::aio::buffer_impl<Pointer>::get() const [with Pointer = char*]’ /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/aio/buffer.h:77: instantiated from here /usr/include/c++/4.4/bits/stl_pair.h:90: error: invalid conversion from ‘int’ to ‘const booster::aio::buffer_impl<char*>::entry*’ /usr/include/c++/4.4/bits/stl_pair.h: In constructor ‘std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U1 = int, _U2 = int, _T1 = const booster::aio::buffer_impl<const char*>::entry*, _T2 = unsigned int]’: /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/aio/buffer.h:34: instantiated from ‘std::pair<const booster::aio::buffer_impl<Pointer>::entry*, unsigned int> booster::aio::buffer_impl<Pointer>::get() const [with Pointer = const char*]’ /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/lib/aio/src/socket.cpp:377: instantiated from here /usr/include/c++/4.4/bits/stl_pair.h:90: error: invalid conversion from ‘int’ to ‘const booster::aio::buffer_impl<const char*>::entry*’ /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/system_error.h: At global scope: /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/system_error.h:56: warning: ‘booster::system::posix_category’ defined but not used make[2]: *** [booster/CMakeFiles/booster.dir/lib/aio/src/socket.cpp.o] Error 1 make[1]: *** [booster/CMakeFiles/booster.dir/all] Error 2 make: *** [all] Error 2 Greetings, Stanimir |
From: Artyom <art...@ya...> - 2010-06-25 12:51:21
|
Hello, Small note - not 4.5 -- 4.4 To be honest, it looks like a compiler bug... Or I do not know C++. The funniest thing that I did tested the code with gcc-4.5 and c++0x flag and it worked well. (See http://cppcms.sourceforge.net/wikipp/en/page/cppcms_1x_platforms) gcc-4.4 (that I fortunately have installed) fails on return buffer_data_type(0,0); Where buffer_data_type is std:pair of <entry const *,size_t> and entry itself defined as struct entry { Pointer ptr; size_t size; } where Pointer is template parameters. Now gcc-4.4 complains that it can't convert 0 (int) to entry const *, where it is clearly (at least for me) legal as I can assign 0 to pointer. Now I fixed this in the code by creating empty buffer_data_type and manually setting first and second to 0. But what I do interested is whether I'm wrong or compiler is wrong. I've commited the fix in changeset 1296 You may take it from the svn or just apply these changes in your copy as shown there: http://cppcms.svn.sourceforge.net/viewvc/cppcms/framework/branches/refactoring/booster/booster/aio/buffer.h?r1=1173&r2=1296 Thanks for the report, Artyom ----- Original Message ---- > From: Stanimir Mladenov <sta...@zo...> > To: cpp...@li... > Sent: Fri, June 25, 2010 2:28:48 PM > Subject: [Cppcms-users] Compilation errors using gcc 4.5 and c++0x > > Hello Artyom, Congratulations for the beta release of CppCms > 1.x.x! I am using the new features of gcc 4.4 and --std=c++0x Here > are some compile errors from it. [ 1%] Building CXX > object booster/CMakeFiles/booster.dir/lib/aio/src/socket.cpp.o In file > included from /usr/include/c++/4.4/bits/stl_algobase.h:66, > from > /usr/include/c++/4.4/bits/char_traits.h:41, > from /usr/include/c++/4.4/string:42, > from > /usr/include/c++/4.4/stdexcept:39, > > from /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/function.h:11, > > from /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/aio/socket.h:12, > > from /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/lib/aio/src/socket.cpp:28: /usr/include/c++/4.4/bits/stl_pair.h: > In constructor ‘std::pair<_T1, _T2>::pair(_U1&&, _U2&&) > [with _U1 = int, _U2 = int, _T1 = > const booster::aio::buffer_impl<char*>::entry*, _T2 = unsigned > int]’: /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/aio/buffer.h:34: > instantiated from > ‘std::pair<const booster::aio::buffer_impl<Pointer>::entry*, > unsigned int> booster::aio::buffer_impl<Pointer>::get() const [with > Pointer > = char*]’ /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/aio/buffer.h:77: > instantiated from here /usr/include/c++/4.4/bits/stl_pair.h:90: error: > invalid conversion from ‘int’ to ‘const > booster::aio::buffer_impl<char*>::entry*’ /usr/include/c++/4.4/bits/stl_pair.h: > In constructor ‘std::pair<_T1, _T2>::pair(_U1&&, _U2&&) > [with _U1 = int, _U2 = int, _T1 = const booster::aio::buffer_impl<const > char*>::entry*, _T2 = unsigned > int]’: /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/aio/buffer.h:34: > instantiated from > ‘std::pair<const booster::aio::buffer_impl<Pointer>::entry*, > unsigned int> booster::aio::buffer_impl<Pointer>::get() const [with > Pointer = > const char*]’ /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/lib/aio/src/socket.cpp:377: > instantiated from here /usr/include/c++/4.4/bits/stl_pair.h:90: error: > invalid conversion from ‘int’ to ‘const booster::aio::buffer_impl<const > char*>::entry*’ /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/system_error.h: At > global > scope: /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/system_error.h:56: warning: > ‘booster::system::posix_category’ defined but not used make[2]: *** > [booster/CMakeFiles/booster.dir/lib/aio/src/socket.cpp.o] Error 1 make[1]: > *** [booster/CMakeFiles/booster.dir/all] Error 2 make: *** [all] Error > 2 Greetings, Stanimir ------------------------------------------------------------------------------ ThinkGeek > and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. > ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and > enter to win: > http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ Cppcms-users > mailing list > href="mailto:Cpp...@li...">Cpp...@li... > href="https://lists.sourceforge.net/lists/listinfo/cppcms-users" target=_blank > >https://lists.sourceforge.net/lists/listinfo/cppcms-users |
From: Stanimir M. <sta...@zo...> - 2010-06-26 09:46:20
|
Thanks, I fetched it from svn! Yes, gcc 4.4 and not 4.5 has the auto and some other nice c++0x features. I will switch in a day to 4.5 for more of them. Actually, CppCms compiles fine without the --std=c++0x flag. I saw you are using the auto keyword in the templates loops if available and since I am using it too, decided to give it to CppCms also. About the error, I think that because the 0 (int) argument is an rvalue and converting it to non const pointer (because the return result is non const). On Fri, Jun 25, 2010 at 3:51 PM, Artyom <art...@ya...> wrote: > > Hello, > > Small note - not 4.5 -- 4.4 > > To be honest, it looks like a compiler bug... Or I do not know C++. > The funniest thing that I did tested the code with gcc-4.5 and c++0x flag > and it worked well. (See http://cppcms.sourceforge.net/wikipp/en/page/cppcms_1x_platforms) > > gcc-4.4 (that I fortunately have installed) fails on > > return buffer_data_type(0,0); > > Where buffer_data_type is std:pair of <entry const *,size_t> and entry itself > defined as struct entry { Pointer ptr; size_t size; } where Pointer is template parameters. > > Now gcc-4.4 complains that it can't convert 0 (int) to entry const *, where it is clearly (at least for me) > legal as I can assign 0 to pointer. > > Now I fixed this in the code by creating empty buffer_data_type and manually setting first and second to 0. > > But what I do interested is whether I'm wrong or compiler is wrong. > > I've commited the fix in changeset 1296 > You may take it from the svn or just apply these changes in your copy as shown there: > > http://cppcms.svn.sourceforge.net/viewvc/cppcms/framework/branches/refactoring/booster/booster/aio/buffer.h?r1=1173&r2=1296 > > Thanks for the report, > Artyom > > > > > ----- Original Message ---- > > From: Stanimir Mladenov <sta...@zo...> > > To: cpp...@li... > > Sent: Fri, June 25, 2010 2:28:48 PM > > Subject: [Cppcms-users] Compilation errors using gcc 4.5 and c++0x > > > > Hello Artyom, > > Congratulations for the beta release of CppCms > > 1.x.x! > > I am using the new features of gcc 4.4 and --std=c++0x > > Here > > are some compile errors from it. > > [ 1%] Building CXX > > object > booster/CMakeFiles/booster.dir/lib/aio/src/socket.cpp.o > In file > > included from /usr/include/c++/4.4/bits/stl_algobase.h:66, > > > from > > /usr/include/c++/4.4/bits/char_traits.h:41, > > > from /usr/include/c++/4.4/string:42, > > > from > > /usr/include/c++/4.4/stdexcept:39, > > > > > from > /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/function.h:11, > > > > > from > /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/aio/socket.h:12, > > > > > from > /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/lib/aio/src/socket.cpp:28: > /usr/include/c++/4.4/bits/stl_pair.h: > > In constructor ‘std::pair<_T1, > _T2>::pair(_U1&&, _U2&&) > > [with _U1 = int, _U2 = int, _T1 = > > const > booster::aio::buffer_impl<char*>::entry*, _T2 = unsigned > > int]’: > /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/aio/buffer.h:34: > > > instantiated from > > ‘std::pair<const > booster::aio::buffer_impl<Pointer>::entry*, > > unsigned int> > booster::aio::buffer_impl<Pointer>::get() const [with > > Pointer > > = > char*]’ > /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/aio/buffer.h:77: > > > instantiated from here > /usr/include/c++/4.4/bits/stl_pair.h:90: error: > > invalid conversion > from ‘int’ to ‘const > > booster::aio::buffer_impl<char*>::entry*’ > /usr/include/c++/4.4/bits/stl_pair.h: > > In constructor ‘std::pair<_T1, > _T2>::pair(_U1&&, _U2&&) > > [with _U1 = int, _U2 = int, _T1 = const > booster::aio::buffer_impl<const > > char*>::entry*, _T2 = unsigned > > int]’: > /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/aio/buffer.h:34: > > > instantiated from > > ‘std::pair<const > booster::aio::buffer_impl<Pointer>::entry*, > > unsigned int> > booster::aio::buffer_impl<Pointer>::get() const [with > > Pointer = > > const > char*]’ > /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/lib/aio/src/socket.cpp:377: > > > instantiated from here > /usr/include/c++/4.4/bits/stl_pair.h:90: error: > > invalid conversion > from ‘int’ to ‘const booster::aio::buffer_impl<const > > char*>::entry*’ > /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/system_error.h: > At > > global > > scope: > /home/stanimir/work/web_common/third_parties/cppcms/framework/branches/refactoring/booster/./booster/system_error.h:56: > warning: > > ‘booster::system::posix_category’ defined but not used > make[2]: *** > > [booster/CMakeFiles/booster.dir/lib/aio/src/socket.cpp.o] Error 1 > make[1]: > > *** [booster/CMakeFiles/booster.dir/all] Error 2 > make: *** [all] Error > > 2 > > Greetings, > Stanimir > > ------------------------------------------------------------------------------ > ThinkGeek > > and WIRED's GeekDad team up for the Ultimate > GeekDad Father's Day Giveaway. > > ONE MASSIVE PRIZE to the > lucky parental unit. See the prize list and > > enter to win: > > > http://p.sf.net/sfu/thinkgeek-promo > _______________________________________________ > Cppcms-users > > mailing list > > > href="mailto:Cpp...@li...">Cpp...@li... > > > href="https://lists.sourceforge.net/lists/listinfo/cppcms-users" target=_blank > > >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > ------------------------------------------------------------------------------ > ThinkGeek and WIRED's GeekDad team up for the Ultimate > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the > lucky parental unit. See the prize list and enter to win: > http://p.sf.net/sfu/thinkgeek-promo > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users |
From: Artyom <art...@ya...> - 2010-06-26 19:44:21
|
> > Actually, CppCms compiles fine without the --std=c++0x > flag. I saw you > are using the auto keyword in the templates loops if > available and > since I am using it too, decided to give it to CppCms > also. Note, I don't really need C++0x mode to get nice way to iterate over collections. Under gcc, intel and even SunStudo (I used to support) compilers I have typeof or __typeof__ which is very close to decltype so auto is not so necessary, but still I'm really looking forward for it in all modern compilers as for C++0x at all. If today C++0x was supported by most compilers I would not need half of Booster today. Regards Artyom |
From: Stanimir M. <sta...@zo...> - 2010-06-28 09:07:08
|
Yes, but using C++0x gives much benefits already and it is really good that you support it to some extend already. Something that already was discussed, is the deprecation of auto_ptr in favor of unique_ptr. At the moment c++0x is enabled, a warning about this is emitted. Is it possible to substitute auto_ptr to unique_ptr the same way you do with auto and __typeof__? It is not a big deal but it looks much better this way. Stanimir On Sat, Jun 26, 2010 at 10:44 PM, Artyom <art...@ya...> wrote: >> >> Actually, CppCms compiles fine without the --std=c++0x >> flag. I saw you >> are using the auto keyword in the templates loops if >> available and >> since I am using it too, decided to give it to CppCms >> also. > > Note, I don't really need C++0x mode to get nice way to iterate > over collections. > > Under gcc, intel and even SunStudo (I used to support) > compilers I have typeof or __typeof__ which is very close to decltype > so auto is not so necessary, but still I'm really looking forward > for it in all modern compilers as for C++0x at all. > > If today C++0x was supported by most compilers I would not need > half of Booster today. > > Regards > Artyom > > > > > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: Artyom <art...@ya...> - 2010-06-28 10:32:16
|
No it is not quite possible, 1. unique_ptr and auto_ptr are different pointers with different semantics. For example: auto_ptr<foo> factory() { auto_ptr<foo> ptr(new foo()); return ptr; } Would not work with unique_ptr as it requires std::move. 2. They are different binary-incompatible classes. For example my code runs on gcc-4.5 without C++0x, if in two years C++0x becomes default with gcc then automatic replacement of auto_ptr with unique_ptr will break backward binary compatibility of the library, so I can't relay on this feature. I think it is stupid to deprecate auto_ptr as it is the only smart pointer existing in C++03 so I hope gcc will remove deprecation warning for most used C++ smart pointer. I don't see any problem with it, the only problem is that some programmers had used it inside STL Collections and got problems with it. Artyom ----- Original Message ---- > From: Stanimir Mladenov <sta...@zo...> > To: cpp...@li... > Sent: Mon, June 28, 2010 12:06:38 PM > Subject: Re: [Cppcms-users] Compilation errors using gcc 4.5 and c++0x > > Yes, but using C++0x gives much benefits already and it is really good that > you support it to some extend already. Something that already was discussed, > is the deprecation of auto_ptr in favor of unique_ptr. At the moment c++0x is > enabled, a warning about this is emitted. Is it possible to substitute > auto_ptr to unique_ptr the same way you do with auto and > __typeof__? It is not a big deal but it looks much better this > way. Stanimir On Sat, Jun 26, 2010 at 10:44 PM, Artyom < > ymailto="mailto:art...@ya..." > href="mailto:art...@ya...">art...@ya...> > wrote: >> >> Actually, CppCms compiles fine without the > --std=c++0x >> flag. I saw you >> are using the auto keyword > in the templates loops if >> available and >> since I am using > it too, decided to give it to CppCms >> also. > > Note, I > don't really need C++0x mode to get nice way to iterate > over > collections. > > Under gcc, intel and even SunStudo (I used to > support) > compilers I have typeof or __typeof__ which is very close to > decltype > so auto is not so necessary, but still I'm really looking > forward > for it in all modern compilers as for C++0x at > all. > > If today C++0x was supported by most compilers I would not > need > half of Booster today. > > Regards > > Artyom > > > > > > > > ------------------------------------------------------------------------------ > > This SF.net email is sponsored by > Sprint > What will you do first with EVO, the first 4G phone? > > Visit sprint.com/first -- > http://p.sf.net/sfu/sprint-com-first > > _______________________________________________ > Cppcms-users mailing > list > > href="mailto:Cpp...@li...">Cpp...@li... > > > target=_blank > >https://lists.sourceforge.net/lists/listinfo/cppcms-users > ------------------------------------------------------------------------------ This > SF.net email is sponsored by Sprint What will you do first with EVO, the > first 4G phone? Visit sprint.com/first -- > href="http://p.sf.net/sfu/sprint-com-first" target=_blank > >http://p.sf.net/sfu/sprint-com-first _______________________________________________ Cppcms-users > mailing list > href="mailto:Cpp...@li...">Cpp...@li... > href="https://lists.sourceforge.net/lists/listinfo/cppcms-users" target=_blank > >https://lists.sourceforge.net/lists/listinfo/cppcms-users |