3 ms·
> consistently named with internal NT APIs I know, but these are mostly not part of WinAPI either. The public API surface has very good names, WriteFile or Cre
by Const-me 7y ago
> consistently named with internal NT APIs
I know, but these are mostly not part of WinAPI either. The public API surface has very good names, WriteFile or CreateDirectory is IMO better than POSIX write or mkdir.
- wvenable 7y agoMy favorite Unix function has to be "creat". It doesn't even make sense given the limitations of the systems at the time.
- cyphar 7y agoIt definitely makes you wonder whether the 'E' key was broken on the machines at Bell Labs. In all seriousness, Ken Thompson was asked what was the one thing we wanted to change in Unix if he could, and his answer was that he would spell "creat" with an "e"[1]. And funnily enough, he actually did in Go[2]. [1]: https://unix.stackexchange.com/questions/10893/what-did-ken-thompson-mean-when-he-said-id-spell-creat-with-an-e https://unix.stackexchange.com/questions/10893/what-did-ken-... [2]: https://github.com/golang/go/commit/c90d392ce3d3203e0c32b3f98d1e68c4c2b4c49b https://github.com/golang/go/commit/c90d392ce3d3203e0c32b3f9...
- rossy 7y agoI don't know if they're good. WriteFile and CreateDirectory are fine, but when I think of the Windows API, I think of much longer function names. I had to use ConvertStringSecurityDescriptorToSecurityDescriptorA() once (and yeah, I had to use the ANSI version explicitly.) Another C/C++ developer might have called that function sec_sddl_to_desc(), which is much better IMO.
- breakingcups 7y agoI know I'm probably in the minority, but I vastly prefer the long-form name in your example. Modern IDE's (especially Visual Studio with its Intellisense) can be incredible with their autocomplete, superseding the need for short-form obtuse acronym-laden function names that you need to remember. So let's assume there's no time difference between writing the long or short form of that function. There's only one other direction to consider, which is reading. Try to approach the following question without personal bias. If you have never worked with either API, which function name would be more self-explanatory for you? ConvertStringSecurityDescriptorToSecurityDescriptorA or sec_sddl_to_desc?
- asveikau 7y agoOne problem is that there is no one Windows style. The style guidelines, if you can call them that, depend on a few things like age and provenance of the component (some examples of pieces with distinct styles: filesystem, registry, GDI, NT API, COM). And sometimes you see a mix of these, or a component come along with its own variation. (SDDL and other security APIs is a good example of a unique style.) But sometimes people confuse unfamiliarity with ugliness, being bad or wrong, and having worked with a lot of these stuff I feel this is often a mischaracterization. Unfamiliarity doesn't always make it bad.