Larry said:
I wasn't suggesting they literally expose it that way (forcing you to use
bit operators). A high-level equivalent is clearly preferable and that's
what I would expect (using one of the availabe bit classes or whatever).
DriveLetterCollection, something like that? Probably not worth it. But with
your bit twiddling acumen, you could write it for the rest.
Almost certainly but you can't assume it regardless of what you might see in
MSFT's (current) implementation.
I'm sorry, I was actually specifically talking about the current
implementation, not trying to make a sweeping statement. Implementations can
change, the Mono guys want to play too, etc, that's not the point. I wasn't
arguing this was some sort of hard guarantee, I was just pointing out that
the managed functions get as close as is reasonable (that is, this is what
the framework guys thought served us best, given the existence of
::GetLogicalDrives()).
It's immaterial in any case. Simply returning a 26 bit array or some
other specific collection would have made more (fundamental) sense IMO.
Eh, lots of room for arguing. A 26-bit collection is still too complicated
for most programmers and most scenarios, and a DriveLetterCollection that
could have answered such neat questions as "what are the unassigned drive
letters, if any" would probably be too much overhead to implement for too
little gain.
Drive letters are so 1960s anyway.
The security issue is unconvincing. For most it will never realistically
fail
Agreed, however, almost all .NET security issues can be marginalized this
way because running with full trust probably is probably a 99% scenario.
and relying on unmanaged code when you don't absolutely have to is an
imperfect situation though not a serious flaw.
Also agreed. I would like to point out, though, that P/Invoking to an
existing function is still a lot less involved than writing your own
unmanaged function and P/Invoking to that, if only because you have to
integrate it in the build and deployment process -- there's some maintenance
overhead.
Ultimately it's a religious issue but in this case doing it the .NET way
seems more like a cult to me (even if it is preaching to the mainstream
masses).
Well if you leave out the "cult" bit I agree it's a religious issue (in the
technical sense). In the framework I trust!
Thankfully this is such a minor issue, technically speaking, that it matters
little how you solve it. For myself, I would only break out the C compiler
if it either couldn't be done in .NET at all, or (increasingly less common)
it couldn't be done fast enough.