[Flightgear-devel] VC90 compile fail in WaypointList.cxx
From this morning´s CVS I now get this with VC++ 2008 :- -- Build started: Project: FlightGear, Configuration: Release Win32 -- Compiling... WaypointList.cxx ..\..\..\src\GUI\WaypointList.cxx(112) : error C2057: expected constant expression ..\..\..\src\GUI\WaypointList.cxx(112) : error C2466: cannot allocate an array of constant size 0 ..\..\..\src\GUI\WaypointList.cxx(112) : error C2133: 'buf' : unknown size lines 111,112 are :- int len = strlen(s); char buf[len]; Alan -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] VC90 compile fail in WaypointList.cxx
Alan Teeder wrote From this morning´s CVS I now get this with VC++ 2008 :- -- Build started: Project: FlightGear, Configuration: Release Win32 -- Compiling... WaypointList.cxx ..\..\..\src\GUI\WaypointList.cxx(112) : error C2057: expected constant expression ..\..\..\src\GUI\WaypointList.cxx(112) : error C2466: cannot allocate an array of constant size 0 ..\..\..\src\GUI\WaypointList.cxx(112) : error C2133: 'buf' : unknown size lines 111,112 are :- int len = strlen(s); char buf[len]; Yup - same here. Looks as if James has uploaded a new file which has incompatibilities with MSVC9 Vivian -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] VC90 compile fail in WaypointList.cxx
Vivian Meazza wrote Alan Teeder wrote From this morning´s CVS I now get this with VC++ 2008 :- -- Build started: Project: FlightGear, Configuration: Release Win32 -- Compiling... WaypointList.cxx ..\..\..\src\GUI\WaypointList.cxx(112) : error C2057: expected constant expression ..\..\..\src\GUI\WaypointList.cxx(112) : error C2466: cannot allocate an array of constant size 0 ..\..\..\src\GUI\WaypointList.cxx(112) : error C2133: 'buf' : unknown size lines 111,112 are :- int len = strlen(s); char buf[len]; Yup - same here. Looks as if James has uploaded a new file which has incompatibilities with MSVC9 Workaround attached - you might have done a better one already, but it does allow a compile. I wouldn't dignify it as a fix :-) Vivian Waypoint.diff Description: Binary data -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] VC90 compile fail in WaypointList.cxx
Hi Vivian, - Vivian Meazza a écrit : Vivian Meazza wrote Alan Teeder wrote From this morning´s CVS I now get this with VC++ 2008 :- -- Build started: Project: FlightGear, Configuration: Release Win32 -- Compiling... WaypointList.cxx ..\..\..\src\GUI\WaypointList.cxx(112) : error C2057: expected constant expression ..\..\..\src\GUI\WaypointList.cxx(112) : error C2466: cannot allocate an array of constant size 0 ..\..\..\src\GUI\WaypointList.cxx(112) : error C2133: 'buf' : unknown size lines 111,112 are :- int len = strlen(s); char buf[len]; Yup - same here. Looks as if James has uploaded a new file which has incompatibilities with MSVC9 Workaround attached - you might have done a better one already, but it does allow a compile. I wouldn't dignify it as a fix :-) Actually you are right, this is not a fix, this is horrible ;-) This should be : int len = strlen(s); char *buf = new char[len]; ... delete buf; I will have to switch back to CVS to commit something better. I am on the git tag for the release for the moment. -Fred -- Frédéric Bouvier http://my.fotolia.com/frfoto/ Photo gallery - album photo http://fgsd.sourceforge.net/ FlightGear Scenery Designer -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] VC90 compile fail in WaypointList.cxx
On 22 Feb 2010, at 17:37, Frederic Bouvier wrote: This should be : int len = strlen(s); char *buf = new char[len]; ... delete buf; Urk I'm confused - I thought this was a C99 feature, is it a GNU extension? Regards, James -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] VC90 compile fail in WaypointList.cxx
- James Turner a écrit : On 22 Feb 2010, at 17:37, Frederic Bouvier wrote: This should be : int len = strlen(s); char *buf = new char[len]; ... delete buf; Urk I'm confused - I thought this was a C99 feature, is it a GNU extension? Yes, I am afraid. This code construction show up in the code from time to time and we have to provide a replacement. I think the best approach is to use an auto_ptr. std::auto_ptrchar buf( new char[len] ); in order to be exception safe. -Fred -- Frédéric Bouvier http://my.fotolia.com/frfoto/ Photo gallery - album photo http://fgsd.sourceforge.net/ FlightGear Scenery Designer -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] VC90 compile fail in WaypointList.cxx
On 22 Feb 2010, at 18:29, Frederic Bouvier wrote: Yes, I am afraid. This code construction show up in the code from time to time and we have to provide a replacement. I think the best approach is to use an auto_ptr. std::auto_ptrchar buf( new char[len] ); in order to be exception safe. Agreed, I'll commit that fix later on this evening. Apologies to Windows folks for the breakage. James -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] VC90 compile fail in WaypointList.cxx
Hi Frederic, Yes, I am afraid. This code construction show up in the code from time to time and we have to provide a replacement. I think the best approach is to use an auto_ptr. std::auto_ptrchar buf( new char[len] ); in order to be exception safe. For array allocations, you need to take care that the array is deallocated using the array delete [] operator, i.e. char *buf = new char[len]; delete [] buf; Using an auto_ptrchar is incorrect in this situation, because it will deallocate using the non-array delete operator. You should use boost::scoped_array (or boost::shared_array if it is to be reference counted) instead. Regards, Manuel -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] VC90 compile fail in WaypointList.cxx
On Mon, Feb 22, 2010 at 7:45 PM, Manuel Massing m.mass...@warped-space.dewrote: Hi Frederic, Yes, I am afraid. This code construction show up in the code from time to time and we have to provide a replacement. I think the best approach is to use an auto_ptr. std::auto_ptrchar buf( new char[len] ); in order to be exception safe. For array allocations, you need to take care that the array is deallocated using the array delete [] operator, i.e. char *buf = new char[len]; delete [] buf; Using an auto_ptrchar is incorrect in this situation, because it will deallocate using the non-array delete operator. You should use boost::scoped_array (or boost::shared_array if it is to be reference counted) instead. The last time I went down this path, I ended up back at good ole std::vector. In this context, std::string would be just fine too. Tim -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] VC90 compile fail in WaypointList.cxx
Hi Manuel, - Manuel Massing a écrit : Hi Frederic, Yes, I am afraid. This code construction show up in the code from time to time and we have to provide a replacement. I think the best approach is to use an auto_ptr. std::auto_ptrchar buf( new char[len] ); in order to be exception safe. For array allocations, you need to take care that the array is deallocated using the array delete [] operator, i.e. char *buf = new char[len]; delete [] buf; Using an auto_ptrchar is incorrect in this situation, because it will deallocate using the non-array delete operator. You should use boost::scoped_array (or boost::shared_array if it is to be reference counted) instead. In theroy, you are correct, but as long as char doesn't have a destructor, this is totally overkill, and not very efficient. -Fred -- Frédéric Bouvier http://my.fotolia.com/frfoto/ Photo gallery - album photo http://fgsd.sourceforge.net/ FlightGear Scenery Designer -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] VC90 compile fail in WaypointList.cxx
The last time I went down this path, I ended up back at good ole std::vector. In this context, std::string would be just fine too. second that :-) Manuel -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] VC90 compile fail in WaypointList.cxx
This file fails to compile even on Linux with g++. I just commented out the problematic line as a quick fix so FG will compile. On Mon, Feb 22, 2010 at 3:03 PM, Manuel Massing m.mass...@warped-space.de wrote: The last time I went down this path, I ended up back at good ole std::vector. In this context, std::string would be just fine too. second that :-) Manuel -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel -- Brant Gipson -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] VC90 compile fail in WaypointList.cxx
Hi Fred, In theroy, you are correct, but as long as char doesn't have a destructor, this is totally overkill, and not very efficient. If the type has no destructor, it won't be called, so the efficiency argument is moot. But the real issue is that calling delete on an array has undefined behaviour. While it often works in practice (because often delete [] defers to delete), it can cause heap corruption (depending on the runtime library or if the delete implementations have been overridden). Additionally, you'll make valgrind puke :-) (and rightly so) See http://www.parashift.com/c++-faq-lite/freestore-mgmt.html#faq-16.13 cheers, Manuel -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] VC90 compile fail in WaypointList.cxx
On 22 Feb 2010, at 20:13, Brant Gipson wrote: This file fails to compile even on Linux with g++. I just commented out the problematic line as a quick fix so FG will compile. That is *very* odd : I build (when I remember) with Ubuntu 9.10 here and everything works - can you be more specific about your build environment? Not that it matters, since I will probably switch to a std::string in a few minutes anyway. James -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] VC90 compile fail in WaypointList.cxx
On Mon, Feb 22, 2010 at 7:23 PM, James Turner zakal...@mac.com wrote: Urk I'm confused - I thought this was a C99 feature, is it a GNU extension? AFAIK it *is* a C99 feature, but not a standard C++ feature (yet). -- Csaba/Jester -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] VC90 compile fail in WaypointList.cxx
I'm building on ubuntu 9.10 64 bit with brisa's compile script. This is my g++ version: g++ -v Using built-in specs. Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.1-4ubuntu9' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu9) OSG, simgear compiles fine without problems. It's just that line that causes make to stop compiling. On Mon, Feb 22, 2010 at 4:44 PM, James Turner zakal...@mac.com wrote: On 22 Feb 2010, at 20:13, Brant Gipson wrote: This file fails to compile even on Linux with g++. I just commented out the problematic line as a quick fix so FG will compile. That is *very* odd : I build (when I remember) with Ubuntu 9.10 here and everything works - can you be more specific about your build environment? Not that it matters, since I will probably switch to a std::string in a few minutes anyway. James -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel -- Brant Gipson -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel