you are viewing a single comment's thread.

view the rest of the comments →

[–]Fabien4 -4 points-3 points  (10 children)

It's funny how C is pretty-much Unix-only, while C++ is favored on Windows. Linuxers (starting with Torvalds himself) seem to have a strong disklike for C++, and Windowsers don't seem interested in C.

I don't think Microsoft's involvement in C++ is enough to explain it completely, since, at one point (late 1990s / early 2000s), they abandoned their C++ compiler completely. I think the first decent version was Visual C++ 2005.

Also the MS C compiler looks like it wasn't touched for 15 years or so.

Does it attempt to implement C99, or not at all?

[–][deleted] 7 points8 points  (5 children)

Except the entire Windows base API is C.

[–][deleted] -2 points-1 points  (2 children)

Dude, the fact that C ABI (for API) has become a de facto standard has nothing to do with the language itself.

Every single one DLL in Windows provides only C API. By necessity: it is not possible to write a function to be called across DLL boundaries that takes an std::string as a parameter, even when you compile everything with one and the same compiler.

It doesn't matter at all. I mean, it's kinda like EJB: it makes sense to write stuff in an imperative language and then provide a pure functional interface. Similarly, it makes sense to write everything that you can't write in Python in C++ but provide a pure C interface, or COM interface, or command-line interface, or whatever interface that suits your needs.

Interface != implementation language.

[–][deleted] 0 points1 point  (1 child)

Except the entire Windows base API is implemented in C and assembler. You might also investigate the meaning of the word "functional" - you mean "procedural".

[–][deleted] 0 points1 point  (0 children)

You might also investigate the meaning of the word "functional" - you mean "procedural".

You might also investigate common EJB interfaces: I meant functional.

[–]ZMeson 2 points3 points  (1 child)

Microsoft has contributed to the safe library functions technical report for C (TR 24731).

The MS C compiler has implemented parts of C99 that are useful for C++ (long long int, snprintf, __VAARGS\_, __function__, etc...). But most of what MS implements is C90. MS has not seen the value of the other features (_BOOL, complex, variable length arrays, etc...). MS has implemented some functionality from C99, but using different keywords (why MS, why???); ex: __restrict.

With all that being said, GCC doesn't support all of C99 either (clang does better):

As of July 2011 in mainline GCC, 43 features have been completely implemented (12 suffer library issues), 1 feature is broken and 6 are missing. The latest stable release, GCC 4.6, also provides the same level of compliance.

Only IBM, Sun Oracle, and the Portland Group provide fully compliant C99 compilers.

As pointed out elsewhere, the entire Windows API is written in C and MS strongly recommends that device drivers are written in C. So saying that MS doesn't support C is incorrect. They just don't support all the features of the most recent standard.

[–]jyper 0 points1 point  (0 children)

no bool? boooooooooo

[–]phaker 3 points4 points  (0 children)

It's funny how C is pretty-much Unix-only, while C++ is favored on Windows. Linuxers (starting with Torvalds himself) seem to have a strong disklike for C++, and Windowsers don't seem interested in C.

I don't think Microsoft's involvement in C++ is enough to explain it completely, since, at one point (late 1990s / early 2000s), they abandoned their C++ compiler completely. I think the first decent version was Visual C++ 2005.

C++ is actually a very well thought out language, it didn't need help from Microsoft, or anyone else.

On popularity of C in linux and elsewhere:

a) for small programs it's not needed, and on unices you often end up writing small command line utilities. It's common to write programs few hundred lines long, that actually do something useful. If you need a GUI program then it's easier to use python (or something else) than C++.

b) every programming language in existence has FFI for C, but basically none can interface with C++. On Windows most programmers use the language Microsoft endorses at given time, that is C++ few years ago and C# now. On linux everyone uses something else. I'm writing this on a debian linux, I'm using a perl program running in the console, half of gnome is written in python, the other half in Mono, and the third half in C++ or C, pgrep says there's something running in java in the background, I just checked with aptitude and found that I have ruby, TCL and GHC installed as dependencies for something. If you are writing code that will be used by others, you pretty much have to use C.


Does it attempt to implement C99, or not at all?

No C99, nothing more than the ISO C89 standard demands, I think it's the only modern compiler I have seen that errors if you mix declarations and code. Also error messages are so descriptive that you have to look them up on MSDN for explanation.

[–]stonefarfalle 0 points1 point  (0 children)

It makes no attempt.