|
Man! If I had the code and the time (which I do not) I would revamp code all over the place. Unrolling loops is an old optimization trick, but you need to know when to do it and when not to. I am not even sure unrolling is even needed today, because the machines today are so fast they make my first computer look like it was standing still.
The new I understand, I never do it, but people sometimes do it to make it easier to match values with indexes.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
This stuff is stunning, not even a line of comment !
Kochise
In Code we trust !
|
|
|
|
|
Oh man, I didn't even notice the absence of 11!
|
|
|
|
|
Cards 1 and 11 are the same, so 11 is skipped, at least something is right
Mostly, when you see programmers, they aren't doing anything. One of the attractive things about programmers is that you cannot tell whether or not they are working simply by looking at them. Very often they're sitting there seemingly drinking coffee and gossiping, or just staring into space. What the programmer is trying to do is get a handle on all the individual and unrelated ideas that are scampering around in his head. (Charles M Strauss)
|
|
|
|
|
So the underlying design is flawed as well?
|
|
|
|
|
Could be depending on the rules of the game. Normally ace is the highest and lowest card, if for some reason an ace could be a 1, or between 10 and jack the implementation would sorta make sense.
--
You have to explain to them [VB coders] what you mean by "typed". their first response is likely to be something like, "Of course my code is typed. Do you think i magically project it onto the screen with the power of my mind?" --- John Simmons / outlaw programmer
|
|
|
|
|
dan neely wrote: would sorta make sense.
...but not much, there's probably a cleaner way.
|
|
|
|
|
PIEBALDconsult wrote: dan neely wrote:
would sorta make sense.
...but not much, there's probably a cleaner way.
the sorta was representing that fact. I didn't immediately see a better way, but assumed a less ugly construct still should exist.
--
You have to explain to them [VB coders] what you mean by "typed". their first response is likely to be something like, "Of course my code is typed. Do you think i magically project it onto the screen with the power of my mind?" --- John Simmons / outlaw programmer
|
|
|
|
|
LMFAO...that's funny. Thanks for the laugh. I'm such a geek..laughing about code.
|
|
|
|
|
whats so difficult about:
for (int c = 0; c < _myHand.CardCount; c++)<br />
{<br />
e[_myHand.Cards[c]]++;<br />
}
This might not work, depending on how the value of the cards are stored, though, in which case just cast to int
---
The sum of the intelligence of the world is constant. The total number of people is always increasing.
|
|
|
|
|
Oh My God, Please visit this Great Horror
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
I am unable to understand the gc concept of the mc++, as per the example for managed pointers in mc++ using gc there is no any proper explanation, i am putting the code, if someone is able to explain it, i will be thankful to you.
__gc struct G
{
int i;
};
__value struct V
{
int i;
};
int main()
{
// defaults to V __gc * __nogc * ppV;
V ** ppV;
// defaults to V __gc * __nogc * __nogc * pppV;
V *** pppV;
// defaults to G __gc * __gc * ppG;
G ** ppG;
// defaults to G __gc * __gc * __nogc * pppG;
G *** pppG;
// defaults to G __gc * __gc * __nogc * __nogc * ppppG;
G **** ppppG;
}
my question is : why there are only two _gc's for the garbage collected why not all are garbage collected, or what is the advantage of _gc pointer coming for one time and coming for two times, can anyone explain me?
-- modified at 5:15 Tuesday 15th May, 2007
Thanks,
Syed
|
|
|
|
|
I don't have an answer for you, but to keep it on-topic, this confusing overloading of the meaning of * was a major flaw in MC++, and it's been fixed in C++/CLI by denoting GC handles with ^ instead.
|
|
|
|
|
Method name (only) changed. It shouldn't even have been public in the first place. Even if you disregard the blatant coding guidelines violations, I think this is a shame.
public string getFormattedDate(string date)
{
string concat ="";
if (null != date)
{
int i;
String dateTimeChar = new String(date.ToCharArray());
for(i=0;i<(date.Length-4);i++)
{
concat = concat+ dateTimeChar[i];
}
concat = concat+ ",";
for(i=4;i<(date.Length-2);i++)
{
concat = concat+ dateTimeChar[i];
}
concat = concat+ ",";
for(i=6;i<(date.Length);i++)
{
concat = concat+ dateTimeChar[i];
}
DateTime dt = DateTime.Parse(concat);
concat = dt.ToString("yyyy-MM-dd");
}
return concat;
}
|
|
|
|
|
Arrgggghhhhh - that's horrible. Let's ignore the fact that the method name is camel cased and hit a particular arrogant nasty. Unless you have a really, really, really good reason (and by that I mean that you can prove to me that you know me much much better than I know myself), don't presume to know how to format a date that I will like. I hate it when people force these cultural settings on me, and I have refused to use some software in the past because it has presented regional variations on me that I don't like because they are downright confusing.
As an example, what date is this?
06/05/07
Is it the 6th May 2007, the 7th May 2006, the 5th of June 2007?
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
It's a very good practice to ensure that any date strings you output to a file that will be consumed by another program have a fixed format. It doesn't much matter what that format is, but there's an ISO standard for yyyyMMdd, so that's what I normally use. (SQL Server is happy to consume that format and do so consistently whatever regional settings are applied).
|
|
|
|
|
Yes, for outputting to a file or other method of "data interchange" use ISO 8601, for output to a person, allow that person's culture to format the date.
|
|
|
|
|
I once got burned by a ASP/ access database site that would create utter crap when move from an english development to a german production server. (Or the other way round? I forget).
|
|
|
|
|
Ick. The obvious solution is
return date.Substring(0,4) + "-" + date.Substring(4,2) + "-" + date.Substring(6,2); Goes nowhere near the risk of DateTime.Parse doing something different in a different locale.
|
|
|
|
|
Even ignoring the language, there are too many things wrong. The most important being that the characters are not being gathered based on their value.
while( date[i] == ‘y’ )
Concat += date[i++];
Or something similar.
I have know idea why the new String is even present, other than to waste time and memory.
The given code is just asking for the call to pass the wrong format, so that it can throw an exception.
In general, this code would receive a ‘D’ at best and an ‘F’ in any production code.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
I'm guessing using the .ToString([inserted quoted format here]) was too difficult. What a shame.
Phil
|
|
|
|
|
Superb HORROR
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
hi all,
can we declare a class without constructor in c++... is it a good way of coding..
thanks,
Vimal
If U Get Errors U Will Learn
If U Don't Get Errors U Have Learnt
|
|
|
|
|
Repeat yourself here instead :
http://www.codeproject.com/script/comments/forums.asp?forumid=3785
Kochise
In Code we trust !
|
|
|
|
|
More people might follow the links that you post if you make them clickable which is very easy to do.
|
|
|
|