Thread overview | |||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
February 28, 2004 DMC and my project, TnFOX | ||||
---|---|---|---|---|
| ||||
After Mark Evans informed me of my incorrect views of DMC++, I finally got round to generating a build tool for DMC for scons (http://www.scons.org/) and gave it a test. Unfortunately I got: dmc -Aa -Ab -Ae -Ar -Nc -Ns -R -mn -WD -g -s -S -gp -DFOXDLL -DWIN32 -D_WINDOWS -D_USRDLL -D_DEBUG -DBUILDING_TCOMMON -DFOXDLL_EXPORTS -DHAVE_JPEG_H -DHAVE_PNG_ H -DHAVE_TIFF_H -DHAVE_ZLIB_H -DHAVE_OPENSSL -ITnFOX\include -ITnFOX\windows -Ii nclude -ITnFOX\windows\libjpeg -ITnFOX\windows\libpng -ITnFOX\windows\libtiff\li btiff -ITnFOX\windows\zlib -Iopenssl\inc32 -c TnFOX\src\FXCanvas.cpp -oobjs\Debu g\FXCanvas.obj template<> struct create<> { typedef NullType value; }; ^ TnFOX\include\FXGenericTools.h(480) : Error: 'create' is already defined TnFOX\include\FXGenericTools.h(476) : Error: ';' expected following declaration of struct member TnFOX\include\FXGenericTools.h(478) : Error: type-argument expected for paramete r 'B' of template 'item' TnFOX\include\FXGenericTools.h(545) : Error: size of FX::Generic::StaticError<un signed short > is not known TnFOX\include\FXGenericTools.h(555) : Error: type-argument expected for paramete r 'B' of template 'item' Fatal error: too many errors The code in question is: template<typename A, typename B> struct item { //! The value of this item typedef A value; //! Either the next item in the list, or NullType typedef B next; }; /*! \struct create \ingroup TL \brief Creates a typelist with up to 16 types \note Make sure you use the ::value member, not create<> itself */ template<typename T1 =NullType, typename T2 =NullType, typename T3 =NullType, typename T4 =NullType, typename T5 =NullType, typename T6 =NullType, typename T7 =NullType, typename T8 =NullType, typename T9 =NullType, typename T10=NullType, typename T11=NullType, typename T12=NullType, typename T13=NullType, typename T14=NullType, typename T15=NullType, typename T16=NullType> struct create { private: typedef typename create<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>::value temp; public: typedef item<T1, temp> value; }; template<> struct create<> { typedef NullType value; }; So, what's going on? I use these typelists through the project so getting this header to compile is rather important! BTW it works fine on MSVC7.1 and GCC v3.4 CVS. I used the latest version of DMC, v8.4 Cheers, Niall -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ |
March 01, 2004 Re: DMC and my project, TnFOX | ||||
---|---|---|---|---|
| ||||
Posted in reply to Niall Douglas | Niall Douglas wrote:
> After Mark Evans informed me of my incorrect views of DMC++, I finally got round to generating a build tool for DMC for scons (http://www.scons.org/) and gave it a test. Unfortunately I got:
>
> dmc -Aa -Ab -Ae -Ar -Nc -Ns -R -mn -WD -g -s -S -gp -DFOXDLL -DWIN32 -D_WINDOWS
> -D_USRDLL -D_DEBUG -DBUILDING_TCOMMON -DFOXDLL_EXPORTS -DHAVE_JPEG_H -DHAVE_PNG_
> H -DHAVE_TIFF_H -DHAVE_ZLIB_H -DHAVE_OPENSSL -ITnFOX\include -ITnFOX\windows -Ii
> nclude -ITnFOX\windows\libjpeg -ITnFOX\windows\libpng -ITnFOX\windows\libtiff\li
> btiff -ITnFOX\windows\zlib -Iopenssl\inc32 -c TnFOX\src\FXCanvas.cpp -oobjs\Debu
> g\FXCanvas.obj
> template<> struct create<> { typedef NullType value; };
> ^
> TnFOX\include\FXGenericTools.h(480) : Error: 'create' is already defined
> TnFOX\include\FXGenericTools.h(476) : Error: ';' expected following declaration
> of struct member
> TnFOX\include\FXGenericTools.h(478) : Error: type-argument expected for paramete
> r 'B' of template 'item'
> TnFOX\include\FXGenericTools.h(545) : Error: size of FX::Generic::StaticError<un
> signed short > is not known
> TnFOX\include\FXGenericTools.h(555) : Error: type-argument expected for paramete
> r 'B' of template 'item'
> Fatal error: too many errors
>
> The code in question is:
>
> template<typename A, typename B> struct item
> {
> //! The value of this item
> typedef A value;
> //! Either the next item in the list, or NullType
> typedef B next;
> };
> /*! \struct create
> \ingroup TL
> \brief Creates a typelist with up to 16 types
> \note Make sure you use the ::value member, not create<> itself
> */
> template<typename T1 =NullType, typename T2 =NullType, typename T3 =NullType, typename T4 =NullType,
> typename T5 =NullType, typename T6 =NullType, typename T7 =NullType, typename T8 =NullType,
> typename T9 =NullType, typename T10=NullType, typename T11=NullType, typename T12=NullType,
> typename T13=NullType, typename T14=NullType, typename T15=NullType, typename T16=NullType>
> struct create
> {
> private:
> typedef typename create<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>::value temp;
> public:
> typedef item<T1, temp> value;
> };
> template<> struct create<> { typedef NullType value; };
>
> So, what's going on? I use these typelists through the project so getting this header to compile is rather important!
I asume the type NullType is defined like this:
class NullType {};
I _think_ the line :
template <> struct create <> { typedef NullType value; };
should be
template <> struct create <NullType> { typedef NullType value; };
Or am I missing something?
Arjan Knepper.
|
March 01, 2004 Re: DMC and my project, TnFOX | ||||
---|---|---|---|---|
| ||||
Posted in reply to Arjan Knepper | On Mon, 01 Mar 2004 10:23:14 +0100, Arjan Knepper <arjan@ask.me> wrote: > I asume the type NullType is defined like this: > class NullType {}; Correct. > I _think_ the line : > template <> struct create <> { typedef NullType value; }; > should be > template <> struct create <NullType> { typedef NullType value; }; > > Or am I missing something? Well you could do that too. However, the point of default template arguments is that you don't need to specify them! :) Cheers, Niall |
March 01, 2004 Re: DMC and my project, TnFOX | ||||
---|---|---|---|---|
| ||||
Posted in reply to Niall Douglas | Niall Douglas wrote:
> On Mon, 01 Mar 2004 10:23:14 +0100, Arjan Knepper <arjan@ask.me> wrote:
>
>> I asume the type NullType is defined like this:
>> class NullType {};
>
>
> Correct.
>
>> I _think_ the line :
>> template <> struct create <> { typedef NullType value; };
>> should be
>> template <> struct create <NullType> { typedef NullType value; };
>>
>> Or am I missing something?
>
>
> Well you could do that too. However, the point of default template arguments is that you don't need to specify them! :)
>
Yes right. But the compiler does not seem to understand it right now, a work around for this problem is to specify the argument in this particular case.
attn: Walter
This is also a example showing a compiler problem/bug.
Arjan
P.S. What is TnFOX? A templated/loki'ed Fox Gui Toolkit?
|
March 02, 2004 Re: DMC and my project, TnFOX | ||||
---|---|---|---|---|
| ||||
Posted in reply to Arjan Knepper | On Mon, 01 Mar 2004 23:32:12 +0100, Arjan Knepper <arjan@ask.me> wrote: > Yes right. But the compiler does not seem to understand it right now, a work around for this problem is to specify the argument in this particular case. I'm very hesitant to alter my source if it's valid C++. My view is that I only work around problems in major compilers and given I've ditched MSVC6 support you can see my attitude on this. > P.S. What is TnFOX? A templated/loki'ed Fox Gui Toolkit? See http://www.nedprod.com/TnFOX/ Cheers, Niall |
March 03, 2004 Re: DMC and my project, TnFOX | ||||
---|---|---|---|---|
| ||||
Posted in reply to Niall Douglas | "Niall Douglas" <s_digitalmars@remove.me.nedprod.com> wrote in message news:opr37kr3qckpcwcj@news.digitalmars.com... > On Mon, 01 Mar 2004 23:32:12 +0100, Arjan Knepper <arjan@ask.me> wrote: > > > Yes right. But the compiler does not seem to understand it right now, a work around for this problem is to specify the argument in this particular case. > > I'm very hesitant to alter my source if it's valid C++. My view is that I only work around problems in major compilers and given I've ditched MSVC6 support you can see my attitude on this. I understand your reluctance to do so. But it would make sense to fork the source, and make the change in a temporary version, to see if there are any other problems. That way, any issues can be resolved much more quickly. -Walter |
March 03, 2004 Re: DMC and my project, TnFOX | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | On Tue, 2 Mar 2004 17:17:21 -0800, Walter <walter@digitalmars.com> wrote:
>> I'm very hesitant to alter my source if it's valid C++. My view is that I
>> only work around problems in major compilers and given I've ditched MSVC6
>> support you can see my attitude on this.
>
> I understand your reluctance to do so. But it would make sense to fork the
> source, and make the change in a temporary version, to see if there are any
> other problems. That way, any issues can be resolved much more quickly.
I am happy to do as with GCC Bugzilla and either post reduced examples illustrating the problem or post preprocessor output - I have found this model most productive for all concerned. I'd like at least one free compiler for Windows besides GCC.
If DMC occupied at least 25% of the Windows compiler market I'd consider forking the sources, but to be blunt, I have better things to be doing and so long as I have a working binary with all the major compilers for each of the three most popular PC architectures, any extra compiler support is cream on the milk as it were.
Otherwise I'll let others get DMC up to scratch and then I'll develop support at that later stage. I know this is selfish but then your compiler is not a community project (ie; free software) is it?
Cheers,
Niall
|
March 03, 2004 Re: DMC and my project, TnFOX | ||||
---|---|---|---|---|
| ||||
Posted in reply to Niall Douglas | Niall Douglas wrote: > I am happy to do as with GCC Bugzilla and either post reduced examples illustrating the problem or post preprocessor output - I have found this model most productive for all concerned. I'd like at least one free compiler for Windows besides GCC. > > If DMC occupied at least 25% of the Windows compiler market I'd consider forking the sources, but to be blunt, I have better things to be doing and so long as I have a working binary with all the major compilers for each of the three most popular PC architectures, any extra compiler support is cream on the milk as it were. > > Otherwise I'll let others get DMC up to scratch and then I'll develop support at that later stage. I know this is selfish but then your compiler is not a community project (ie; free software) is it? I can understand your reluctance to forking code or providing an #ifdef that deals with "broken" default template instantiation. However, compared to other semi-free compilers or even "free" compilers, DMC does a much better job than most. Try compiling with OpenWatcom, which has a lot more catching up to do. If you really want a bug fixed, why not contribute some money or make it worthwhile for Walter to fix your bug before others on the list? Frankly, if I had the resources, I would make far larger donations to getting the bugs fixed that are near and dear to my heart. When push comes to shove, all compilers have issues. But DMC seems to have fewer issues than others and the C++ runtime is redistributable. That's the primary reason I use DMC -- ever tried to compile libstdc++ as a DLL? Or agonize over STLport? -scooter |
March 03, 2004 Re: DMC and my project, TnFOX | ||||
---|---|---|---|---|
| ||||
Posted in reply to Scott Michel | > >If you really want a bug fixed... > >-scooter Go easy on Niall. His position is reasonable and he can serve as one more bug reporter bringing DMC++ to full compliance. DMC++ needs heavy-duty template programmers like Niall for stress testing. Niall, just post stripped- down code snippets right here for Walter. Then check back often for new beta releases incorporating fixes. The best thing is to work on full C++ compliance so that, (perhaps alone among compilers) DMC++ won't require #ifdef workarounds. That day seems not too far off and then "supporting" DMC++ will be trivial. After that, we can pound on Walter for a Linux port... but then we'll need gcc's C++ extensions as well as the current Microsoft C++ extensions...hmm... Mark |
March 03, 2004 Re: DMC and my project, TnFOX | ||||
---|---|---|---|---|
| ||||
Posted in reply to Scott Michel | On Wed, 03 Mar 2004 10:51:23 -0800, Scott Michel <scottm@cs.ucla.edu> wrote: > I can understand your reluctance to forking code or providing an #ifdef that > deals with "broken" default template instantiation. However, compared to > other semi-free compilers or even "free" compilers, DMC does a much better > job than most. Try compiling with OpenWatcom, which has a lot more catching > up to do. I always found GCC v3.2.2 fine for most tasks - any work arounds were basically clarifications in heavy usage of template parameter deduction and such. However v3.4 is OUTSTANDING and compiles stuff even MSVC7.1 has trouble with. > If you really want a bug fixed, why not contribute some money or make it > worthwhile for Walter to fix your bug before others on the list? Frankly, > if I had the resources, I would make far larger donations to getting the > bugs fixed that are near and dear to my heart. I hate to be mean but it's a competitive market out there. Even among free (of cost) software you must compete on features and right now DMC is lagging behind GCC considerably. If I had money to splosh around, I'd pick GCC. It comes with source after all and there's no chance of it vanishing and leaving me up the creek. Cheers, Niall |
Copyright © 1999-2021 by the D Language Foundation