|
I'm going to be mildly contrary and say that I wish I knew that this:
if (condition)
{
;
}
was legal years ago. When I tried putting conditional breakpoints inside hot loops in VS2010 I saw order of magnitude slowdowns (from ~100k to 10k iterations/second). Putting a breakpoint on this slightly larger kludge:
int foo;
if (condition)
{
foo = 1;
}
OTOH had almost no impact on throughput. The project in question has been over for many years now; and I haven't do anything that heavily compute bound since so it's possible newer versions of VS have removed the performance penalty but getting so badly burned a few years ago left a really bad taste in my mouth.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
I don't use it, but back in my Pascal days I would insert extra semi-colons because I had a utility that would count them to determine how many statements were in a program.
Nowadays, when I use the debugger (VS 2012), I often put breakpoints on closing BRACEs.
|
|
|
|
|
Directory.GetFiles!!! Haven't looked yet, but it has to be there.
It's totally blocked until it returns.
Directory.GetFiles() has my vote!!
I remember you FindFirstFile, FindNextFile API and I remember you fondly.
|
|
|
|
|
Well, that's not a feature of C#, so much as a feature of the framework.
|
|
|
|
|
Yes, you are right, of course.
I got excited to be able to complain to someone about Directory.GetFiles().
I like C# because it is like a friendly version of The Best Language in the Entire Universe: C++
Let the language-wars begin!
|
|
|
|
|
|
I always forget about that one because it is new -- added in .NET 4.0.
It is a bit different from the original FindFirstFile too -- you could easily cancel the work of enumeration on the original one. This call just seems to run. How would you cancel it?
However you have inspired me to work with this method and learn more about it.
It is interesting since it could run on one thread I suppose and you could iterate the list on another thread?
|
|
|
|
|
newton.saber wrote: How would you cancel it?
Usually by terminating a loop.
newton.saber wrote: iterate the list on another thread?
Or several if you like.
|
|
|
|
|
I can't do anything else than approving the termination of the unary plus operator
I fully agree on the IEquatable<> and IComparable<> interfaces implementation nightmare; considering the fact that we have to deal with structs and classes differently, we end up with four different ways to do basically the same thing.
I also agree on the fact that two concepts that do not overlap should not be implemented in a single object (ex: integers/bit arrays, enums/flagged enums). Having a consistent system for bit-arrays handling would be a great improvement.
I had never imagined that using increment and decrement operators could be a problem. I use them pretty much. Maybe there are better ways to achieve the same goals, but I never had a readability problem with them; they just make a lot of simple expressions very concise.
It would also be very painful to me if I had to give up on the for loop.
while (true) {
continue;
}
|
|
|
|
|
phil.o wrote: I also agree on the fact that two concepts that do not overlap should not be implemented in a single object (ex: integers/bit arrays, enums/flagged enums). Having a consistent system for bit-arrays handling would be a great improvement. I see this a lot, but they do overlap. A lot of the power of using an int as a bitarray comes from the ability to use operations that aren't strictly bitwise, for example x & -x selects the lowest set bit (if there is one) without having to look for it,
x & x - 1 removes the lowest set bit (used also as part of determining whether a number is a power of two), or to take a more practical turn, the o^(o-2r) trick in chess engines.
Meanwhile integers that we pretend aren't bitarrays (they still are) benefit from bitwise operations, for example testing whether it's a power of two (as above), rounding up/down until it is a power of two (involves a bunch of shift/or), rounding down to a known power of two (eg x & -16 is the canonical way to round x down to a multiple of 16), and even knocking off the lowest set bit (as above) in the indexing of a Fenwick tree (it's not a bag of bits there, it's an index), the FFT bitreversal (again an index, not a bag of bits).
Arithmetic operations and bitwise operations are not two different worlds, they mix in useful ways.
|
|
|
|
|
phil.o wrote: termination of the unary plus operator
NO! That would violate the Orthogonality Principle! (Or is it the Regularity Principle?)
Heathens at the gate! Heathens at the gate!
|
|
|
|
|
I'm surprised there's nothing on the overuse of ?.
MyClass item = passedIn != sentinel ? otherItem : defaultValue;
item = item ?? otherCouldBeNullValue;
item?.DoSomething();
|
|
|
|
|
Pete O'Hanlon wrote: MyClass item = passedIn != sentinel ? otherItem : defaultValue; Should the inverted question mark, unicode U+BF ¿ flip the sense of the boolean?
Pete O'Hanlon wrote: item = item ?? otherCouldBeNullValue; Why doesn't unicode U+2047 ⁇ work like the double ?
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G.K. Chesterton
|
|
|
|
|
You mean that several various operators contain a question mark? Meh, I'm OK with that -- at least until I see
MyClass item = someitem ?? otherCouldBeNullValue != sentinel ? otherItem?.DoSomething() : defaultValue;
I don't blame the designers for abuse.
|
|
|
|
|
Exactly - and you know that sooner or later people will start accepting R# suggestions that end up producing horrors like that.
|
|
|
|
|
Many engineers develop some bad habits over their years of forging code. Here are seven career-breakers software engineers need to ditch. Collect the whole set!
|
|
|
|
|
Here's the 8th: being a patronizing git, just like the author of the article.
|
|
|
|
|
Most of these aren't habits of the developer, but consequences. Passion gets killed easily if you have no say in what you are doing, and saying "NO" is one of the most important skills a dev can have.
Scope-creep is one of the reasons why a lot of projects go beyond their deadline. Learn to say no, we got a product to ship.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
This article is intended to highlight some of the key advantages and disadvantages typically experienced by enterprises. It then presents the key questions to be contemplated by your enterprise in determining whether Git is right for you and what you need to consider in moving to Git. To Git, or not to Git. Whether 'tis nobler in the mind to rebase the branches...
|
|
|
|
|
Regardless if you opt for Intel's latest platform and DDR4, or go for last season's Haswell range with more affordable DDR3 memory, you'll likely ask yourself: "Should I get 8GB or 16GB of RAM?" Is more always better?
|
|
|
|
|
I did not ask, I just went for 16GB.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Me too. I don't want to have to think before debugging a mobile client using Android Studio and a web app using VS2013 simultaneously. My GigaByte BRIX (4th gen i7, 16G RAM, 500G SSD) flies!
/ravi
|
|
|
|
|
|
Afzaal Ahmad Zeeshan wrote: Android Studio is an idiot IDE in manner of memory-consumption; Hmm, it seems to work well for me. Seems faster and more robust than Eclipse.
Afzaal Ahmad Zeeshan wrote: 1TB HDD *Beat ya!*. A 1TB SSD? Nice!
/ravi
|
|
|
|
|
In case of Eclipse and Android Studio, indeed, it is a better IDE for Android programming. But I was comparing it with Visual Studio.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|