4 ms·
Ha ha ha, #ifdef __cplusplus extern "C" { #endif I guess you will have to rewrite libc.so and ntdll.dll in C++ first. Or at least fork them and maintain
by qb45 9y ago
Ha ha ha,
#ifdef __cplusplus
extern "C" {
#endif
I guess you will have to rewrite libc.so and ntdll.dll in C++ first. Or at least fork them and maintain the fork indefinitely.
- pjmlp 9y agoThey are already written in C++, pay attention to the news! https://blogs.msdn.microsoft.com/vcblog/2014/06/10/the-great-c-runtime-crt-refactoring/ https://blogs.msdn.microsoft.com/vcblog/2014/06/10/the-great... "We have converted most of the CRT sources to compile as C++, enabling us to replace many ugly C idioms with simpler and more advanced C++ constructs. The publicly callable functions are still declared as C functions, of course (extern "C" in C++), so they can still be called from C. But internally we now take full advantage of the C++ language and its many useful features." Note the reference to ugly C idioms. Also all major C compilers are written in C++, including clang and gcc, did you miss that as well?
- hawski 9y agoSeeing "replace ugly C idioms" my first reaction was: "why didn't they use "nice C idioms instead?".
- pjmlp 9y agoBecause nice C idioms is an oxymoron.
- mkup 9y agoCRT != ntdll.dll and CRT != kernel32.dll. CRT is an optional component of Windows software, a layer above ntdll and kernel32. Anyone can easily compile a program without C runtime library using /Zl compiler option. In this case, only Win32 and native API functions will be available, but not functions like printf() or strcmp(). So latest versions of CRT could be rewritten in C++, but this has nothing to do with documented OS API or even low-level undocumented native API, which are both still pure C.
- pjmlp 9y agoThe compiler switch /kernel was introduced with Visual Studio 2012 (Windows 8). https://msdn.microsoft.com/en-us/library/jj620896(v=vs.110).aspx https://msdn.microsoft.com/en-us/library/jj620896(v=vs.110).... C code is considered legacy by Microsoft with C++ being the official systems programming language, hence why they dropped support for newer C versions, except for what is required by ANSI C++ standard. https://herbsutter.com/2012/05/03/reader-qa-what-about-vc-and-c99/ https://herbsutter.com/2012/05/03/reader-qa-what-about-vc-an... Our focus in Visual C++ is on making a world-class C++ compiler Our primary goal is to support "most of C99/C11 that is a subset of ISO C++98/C++11." We do not plan to support ISO C features that are not part of either C90 or ISO C++. Also the future of Windows lies on UWP, and C is certainly not a way of writing UWP APIs, unless one enjoys low level COM Windows 95 style. Finally, the remaining C code is slowly being migrated to C++ https://www.reddit.com/r/cpp/comments/4oruo1/windows_10_coded_in_c_or_assembler/d4g9we9/ https://www.reddit.com/r/cpp/comments/4oruo1/windows_10_code...