6 ms·
I can answer questions either here or on VCBlog. EDIT: Specifically, questions about the C++ Core Language and Standard Library, which is what I work on all da
by StephanTLavavej 11y ago
I can answer questions either here or on VCBlog.
EDIT: Specifically, questions about the C++ Core Language and Standard Library, which is what I work on all day; questions about other topics are welcome but other MS people will have to answer them, since I am mostly clueless about other areas.
- modeless 11y agoFor iOS and Android apps you must have implemented some POSIX APIs that Windows hasn't supported historically, such as pthreads. Will it now be possible to write a Win32 app using pthreads?
- mmozeiko 11y agoMy guess would be that they are wrapping native threading under pthread api. So there is no advantage of using pthread api for win32 apps.
- modeless 11y agoThe advantage is portability. For example, if you're developing a library that needs to be usable on Win32, Linux, and Darwin.
- comex 11y agoIn C++ you can use std::thread for this purpose. In C, in theory C11 thrd_* would be better to implement than pthreads, since it's been standardized... too bad none of the major platforms support it in their default libcs, so Windows implementing it wouldn't actually improve portability. If Windows implements pthreads, maybe there'll be a C1y that removes thrd_* from the standard and just standardizes pthreads. That'd be funny.
- mmozeiko 11y agoFunny, but VS2013 has <thr/xthreads.h> header that pretty much is C11 <threads.h> implementation. Just with a bit different naming of symbols. And not sure if it is 100% compatible.
- StephanTLavavej 11y ago<thr/xthreads.h> is internal and unsupported; please don't use it.
- mmozeiko 11y agoI understand your point. But that won't solve portability issue, because I bet their pthread API will be available on VS2015 (if at all). No portability for VS2013 or less. For my code I simply just wrap the native threading api - posix or win32. It's not a big deal.
- deleted 11y ago[deleted]
- StephanTLavavej 11y agoI don't know anything about iOS/Android targeting, but I've asked people who do to comment. I do not believe that pthreads will be available for Win32 but I could be wrong.
- AlexeyBrin 11y agoIf you are using C++ or Objective-C++ you can use C++11 threads (which are portable on all current operating systems) directly, no need to use pthreads.
- angersock 11y agoSome of us aren't using C++. Hence, the desire to see MSVC support the C11 and C99 standards.
- AlexeyBrin 11y agoI don't use C99/C11 regularly, but I would love to see a VS that fully implements at least the C99 standards. My comment was specifically about using pthreads which are standard only on UNIX like systems.
- pavanky 11y agoThis may be off topic, but why are min and max macros by default ? It is the problem we face most often when we compile our library on windows.
- mmozeiko 11y agoCompatibility for old code? Just "#define NOMINMAX" before including windows.h
- StephanTLavavej 11y agoIn fact, VS's STL has to defend itself against those macros. Since the user might have already included windows.h without NOMINMAX, what we do is parenthesize all mentions of min/max, which inhibits preprocessor expansion of function-like macros. Look at our declarations of std::min()/etc.
- TillE 11y ago> what we do is parenthesize all mentions of min/max Oh! That explains some of the odd-looking code in <random>, since min and max are used as function names to determine the range of an RNG engine.
- StephanTLavavej 11y agoBingo. We have a test that includes windows.h followed by all STL headers, to verify that we always remember the parens.
- Someone 11y agoMy guess: for backwards compatibility. I bet you also still get that oh so useful "Windows made this file for you" text file if you use a traditional Windows solution template. For those unfamiliar with this issue: if you include Windef.h (directly or indirectly) you get what the platform provides. That file by default defines min and max macros. To prevent that, define NOMINMAX before including the windows header (in the source, or as a command line argument to the compiler). (https://support.microsoft.com/en-us/kb/143208 https://support.microsoft.com/en-us/kb/143208)
- agottem 11y agoHow about taking a month of an interns time and adding C99 support to your compiler?
- spongo2 11y agoHey, VC++ Dev Mgr here. Our official statement hasn't changed which is that we will enable major libraries but we need to prioritize C++ over C. Let me know if there is a library that is blocked that we don't know about and I will see what we can do. I will also say that the requests for C99/C11 seem to be increasing and we are listening. :)
- angersock 11y agoC99 has always been requested by people trying to write portable code, and you nice folks just haven't been listening. It's not an individual library--it's hack on hack on typedef on #define on hack to ensure compatibility, scattered across many projects. If Microsoft is going to want to start winning over 'Nix developers, they need to get their shit together before somebody pairs a Windows port of Clang with a half-decent IDE. EDIT: A few things better than just a "aaaargh implement the standard" rant: The threading and atomics in C11 would be really nice to have. The features listed here ( http://blogs.msdn.com/b/vcblog/archive/2013/07/19/c99-library-support-in-visual-studio-2013.aspx http://blogs.msdn.com/b/vcblog/archive/2013/07/19/c99-librar... ) especially the snprintf support. Last I checked, vsnprintf returns -1 instead of a useful character count when given a buffer too small, thus requiring use of _vsnprintf_s in a loop to try to figure out how much space is needed. I'm not sure, but I think the most recent MSVC still doesn't support the "restrict" qualifier. I'm sure there's other things as well. EDIT2: Part of the reason we want proper C99 support is that certain behaviors for implicit casting and whatnot change when done in a C++ compiler.
- StephanTLavavej 11y agoThe C99 Standard Library has been completed in 2015, including snprintf, with the exceptions noted in my post (tgmath.h and pragma macros).
- Serow225 11y agoC99 and C11 support plans.
- stephencanon 11y agoYes please.
- spongo2 11y agoVC++ dev mgr here. I replied to a similar question above. please let check that out.
- Marat_Dukhan 11y agoA new C standard does not triumph by convincing Microsoft and making them see the light, but rather because Microsoft eventually dies and a new generation grows up that is familiar with it
- zer0nes 11y agoDo you have any plan on making VC++ cross platform so that I can compile C++/CLI code? See the discussion on CoreCLR here: https://github.com/dotnet/coreclr/issues/659 https://github.com/dotnet/coreclr/issues/659 If not, what do you think would be the most likely-way forward for cross-platform C++/CLI: - Forget it - Make VC++ cross-platform - clang/gcc to support C++/CLI and produce mixed-mode assembly ?
- pmelendez 11y agoJust as curiosity. Why constexpr has taken so long to be fully implemented? I can't wait to use Cap'n Proto on VS :)
- StephanTLavavej 11y agoVC's current lack of an AST makes constexpr and other major features (especially variadic templates) very difficult. As the compiler devs have explained to me, this was a clever way to save space and time decades ago when C++ was simpler to compile. Features like constexpr and variadic templates make C++ easier to use, but they demand much more from the compiler's data structures.
- forrestthewoods 11y agoI always wondered about this. Interesting.
- pmelendez 11y agoThanks! This actually helps a lot to understand what's going on.
- harry8 11y agoI'm a bit anti-MS at times but I have to say I really like the way you, specifically you STL, engage with developers at places they hang out online and treat them with respect. It makes me feel a lot better about MS as a company. Still a long way to go() but I feel like you're making the valiant attempt. So cheers for that. () I still resent MS for various reasons, eg paying for windows licenses on laptops over the last deacde that I didn't want and I resent MS's "Oh it's not us, talk to the manufacturer" attitude, it's dishonest. There are plenty of other gripes, the company gets called "The Death Star" not for no reason. FAT patent? yah.
- StephanTLavavej 11y agoThanks! I just try to follow the meta-golden rule: treat your users as you would prefer to be treated by your implementers.
- arximboldi 11y agoHi! I see there is still no "expression SFINAE", which makes me very sad, since for me the most really important use-case for decltype() is SFINAE... it basically allow to have C++17 style concepts on top of plain C++11. I wonder, why is this not planned yet? It feels unreasonable to me that many C++14 features have been added yet this is not there. It is very unconfortable to write cross-platform code this way, since you can not even tell tour team "stick to standard C++11", but instead have to elaborate intricate coding guidelines listing all features that VS don't support (our other compilers, GCC and Clang are quite good at this). So, could you elaborate a bit on why is this feature not there and what are the plans to add it? On the other hand, I appreciate a lot that you guys are becoming reachable here. Thanks!
- StephanTLavavej 11y agoSee the FAQs at the bottom of the post: "Q. I want Expression SFINAE." and "Q. When will you implement Expression SFINAE?".