amotif
Check me out on the web at Code Never Written.
I moved! Find me at http://channel9.msdn.com/Niners/Curt%20Nichols
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
Programming in the Age of Concurrency - Anders Hejlsberg and Joe Duffy: Concurrent Programming with
Oct 13, 2007 at 11:26 AMGood video.
That's an interesting thought. I have no particular insight into the answer, but I'm guessing it would be quite difficult to implement due to at least a couple reasons:
a) To generalize your question (correctly, I hope), it's not just globals that are a concern, it's any shared state--is your lambda expression using shared state in a thread-safe fashion? Here's a simple non-global example:
R r = new R();
Parallel.For(0, 1000,
i => {
int v = r.Next(1, 6);
...
});
Here we have N threads accessing r. How do you determine whether r is being used in a thread-safe manner? If you know that class R is not thread-safe, then this code isn't either. But how would a compiler or runtime determine whether this is safe, through static or run-time analysis of all the possible code paths? This seems to me to be a rather difficult problem.
b) Aside from the difficultly of analyzing the code, how do you define what's "correct?" If I substitute a thread-safe class for R how would you now determine that the use of r is now thread-safe? Perhaps analysis would show the use of a locking mechanism? What if the new class is written using a lockless technique, how would you determine whether it's safe or not?
As mentioned in the video some problems require shared state and some problems don't. For example, consider applying update operations to a graph in parallel. Shared state isn't a side effect here; in fact, the whole point is to update shared state. How would analysis take that into account?
It's an interesting thought, though.
S. Somasegar (Soma) and Scott Guthrie on Orcas Beta 2: What's in it?
Jul 27, 2007 at 12:01 PMI like to think we're also less distracted by bright, shiny objects.
Simon Peyton-Jones: Towards a Programming Language Nirvana
Jul 21, 2007 at 8:54 AMARCast.net - Service Oriented Infrastructure (Part 2)
Apr 07, 2007 at 8:26 AMARCast.net - Someone Actually Doing SOA
Mar 03, 2007 at 9:40 AMI took 31 minutes of it and think Ron did an adequate job of simplifying or digging deeper when Chris' answers sounded opaque or insubstantial. Some parts of this business involve a lot of new terminology, architecture and SOA being among them.
Jim Allchin: It's time - Windows Vista RTM
Nov 10, 2006 at 6:27 PMNice interview.
Charles,
When you mention creating a Media Center add-in for C9, can I assume that you folks are planning on using Vista's RSS engine to download the C9 Videos feed (maybe Podcasts, too) and using the RSS engine's capability to automatically download the video file (background transfer via BITS, of course) and make that available for viewing?

Please?
Just an idea I've had.
Scoble: Exit Stage Left
Jul 07, 2006 at 10:15 PMRobert, good luck on your new venture! And the one beyond that, and the one beyond that, and the one beyond that!
VC++: Safe Libraries with Martyn Lovell
Apr 29, 2006 at 7:56 AMMartyn, I think that's a compliment.
sz is the size of the character array you've declared on the stack. sz1 is the size of the char* you've passed to the function. You've declared it as char[], but the compiler really passes a char*, not the full array. Someone (Sven?) can probably put that in C++ specification-compliant terms.
It's probably better to compare strncpy_s to strncpy since they do the same thing. (strcpy_s copies a whole string, strncpy copies N characters.)
strncpy_s returns error information where strncpy does not. It's difficult to write "good" code with strncpy (where "good" means checking for errors). strncpy does not return an error code because it doesn't know the size of the output buffer.
EDIT: Oh, and memcpy is ignorant of types and their sizes. It copies bytes, not characters. With it you can do things like:
int i;
memcpy(&i, "Hello, world", sizeof(i));
Which you just about never want to do. If you know you're copying strings, use the string functions--the compiler can do more type checking for you.Alan Cooper - Questions after his keynote
Mar 14, 2006 at 11:17 PMIsn't that the funnest reaction? It's strongest when the customer can't quite clearly describe the problem they're trying to solve and you wrap it up nicely in a little box with a bow and hand it back to them. "Zounds! That's it!"
Some aspects of this field really are satisfying. How odd that it involves people.
Jenny Lam - Designing Experiences at Microsoft
Feb 09, 2006 at 7:00 PMSee more comments…