I'm going to send you an improved version.
I'm going to send you an improved version.
I am participating. I emailed you my submission, sangdrax.Please post in this thread if you're participating!
Question to the rest of you who have successfully completed the task: what compiler are you using? I cannot compile with Borland5.5, and the value works in a static array in MSVC++v6 only with a particular change to the struct.
I used VC++ 2003 .NET
"...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers
I used the IDE for VC++.NET but I've updated the compiler with the free download for VC++.NET 2003.
The other compilers before that choke on most template stuff.
Other template stuff I have done in the past has been on Codewarrior or MingW
Take a peek over here - http://cboard.cprogramming.com/showthread.php?t=56548. That's a free VC++ compiler that can handle templates pretty well
Thanks for the link Fordy. Unfortunately I can't give it a go here at work because XP is the min OS. Sounds promising, though.
I'm on 2K and works for me
Submitted an entry.
If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein
Not to split hairs, but yeah, that's what I meant. XP is the min OS for the "toolkit" and at work I've a mere 98 box...Originally Posted by Fordy
1# First I don't get this:If I do something trivial likeCode:char data[ SquareRoot<16>::v ];I still get compiler errors, like:Code:template<int x> const int SquareRoot<x>::v = 2;
error C2057: expected constant expression
error C2466: cannot allocate an array of constant size 0
error C2133: 'data' : unknown size
The template is decided at compile time... Why not the static variable?
Are you able to compile this?
If not, try the link Fordy provided and download a better compiler.Code:template <int n> struct Test { static const int v = n; }; char data[ Test<16>::v ];
I haven't received anything.Originally Posted by pianorain
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling
I had the same problem and had to resort to change v to an enumerated type (using MSVC6).
I used both the .NET compiler and my MSVC++6 compiler.. both gave me the same result...Originally Posted by Sang-drax
[edit]
worked fine now.. probably distraction of mine
Last edited by xErath; 09-26-2004 at 08:11 PM.
Solution sent and it works perfectly!
OK, I've lost every contest entry I've receieved so far.
The reason is this:
http://cboard.cprogramming.com/showthread.php?t=57298
Preliminary, this contest is closed for more submissions.
I'm unable to recive and judge more entries (I have no compiler). I know who is the winner though. If it's OK with you, I'll announce the winner and every contestant can post the submission they used.
I've seen your updated submission xErath, but not compiled it. I'm not going to use it when I judge the competition, sorry.
Last edited by Sang-drax; 09-29-2004 at 02:37 AM.
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling
Wow that's nasty! You must be gutted...
I'm OK with this, but I'll have to post mine tomorrow as I'm in work now and I'm not home tonight