Linked by R_T_F_M on Thu 13th Sep 2012 21:19 UTC
FreeBSD "For the past several years we've been working towards migrating from GCC to Clang/LLVM as our default compiler. We intend to ship FreeBSD 10.0 with Clang as the default compiler on i386 and amd64 platforms. To this end, we will make WITH_CLANG_IS_CC the default on i386 and amd64 platforms on November 4th."
Thread beginning with comment 535171
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[6]: C++
by boldingd on Sat 15th Sep 2012 08:34 UTC in reply to "RE[5]: C++"
boldingd
Member since:
2009-02-19

"Ever tried to link a program unit written in C++ into a project written FORTRAN? It's possible, but ugly. It's much easier to link a C program unit into a FORTRAN project.


extern "fortran" ....
"

Unless the C++ program unit has global static instances of classes with default ctors that need to run; then your compiler and linker need to know to find those initializers and run them.

"C has a lot of other use cases too, of course, but C-style linking is definitely still the lingua franca of multi-language projects.


On the operating systems, where the ABI == C linkage model.

On Lilith for example, you would need to use Modula-2 linkage module. In Native Oberon, the ABI is Oberon based. In Spin it is Modula-3 based and so forth.

You can argue they are all dead, but lets take Windows 8. On the platforms where the only Windows ABI is WinRT like the ARM tablets, the lowest API is COM and the only native code compiler C++.
"

The problem isn't only the system API, the problem is things like pre-main initialization. Other languages have state that the system needs to keep track of; maybe they have a GC that needs to be updated, maybe they have pre-main initializers that need to happen, maybe they have some other structure that the language run-time is supposed to keep track of. C doesn't do any of that; when you link in a C library written in C, you know that there's no implicit pre-main that you need to call, and no GC whose state needs updating, and etc.

(Yes, C libraries can have init routines, but they're explicit and part of the documented API; if you get someone else's C++ library, that isn't supposed to be linked into C or FORTRAN or Ada code, and try to link it in anyway, you have to figure out what your compiler and platform name the premain, hunt it down, and invoke it explicitly, which is a large part of what I was referring to when I said "it was nasty". And if more than one premain initialization routine was generated, you get to worry about that, and if the order in which they're called is constrained, you get worry about that.)

In this case, your languages need to communicate via the COM bindings, there is no C interop any longer.

Sure you can still use C, but it will be C communicating via the COM API.

This means in the long run, C++ replaces C as the lowest API on Windows, if WinRT is sucessfull.


We're talking about different things. COM is an object-communication system, not a library linking system. As far as I can understand it (and I'm not a Windows developer), COM would take care of the problem of communicating objects between heterogeneous languages, but it's not an ABI or linking standard and it wouldn't take care of actually linking the program units in the first place.

Which, you're right, would make cross-language linking much easier if you're working with Microsoft's native tools and the set of languages that it's build system and platform well-support, but won't help you at all if you're trying to link in an Ada or FORTRAN unit.

In Symbian likewise, if you're using some C stuff, you're actually compiling C like code in a C++ compiler, because the ABI and exposed interfaces are all C++ based.

Again, C as lingua franca only works if C is the language exposed by the operating system. Lets not forget there were system programming languages before it, and after it, why should C exist forever?


And the system-development languages before it blew, which is why C was developed. And the system-development languages used after it have to be restricted; remember the above post about how C++, when used as a kernel language, can't make use of a laundry-list of features? That's because of the same problem; you can't use features that would require the generation of implicit premains, or would refer to state that the underlying system is supposed to maintain (because in a kernel, there is no underlying system). The system-development-safe part of C++ you end up with isn't much larger or much different than C.

Reply Parent Score: 2

RE[7]: C++
by moondevil on Sat 15th Sep 2012 14:02 in reply to "RE[6]: C++"
moondevil Member since:
2005-07-08

We're talking about different things. COM is an object-communication system, not a library linking system. As far as I can understand it (and I'm not a Windows developer), COM would take care of the problem of communicating objects between heterogeneous languages, but it's not an ABI or linking standard and it wouldn't take care of actually linking the program units in the first place.


Since when? COM is all about libraries.

Your COM components can exist in separate executables, for more security. In this case a kind of local RPC is used.

However, most COM components are actually dynamic libraries that get dynamically linked with your application and follow the same format as C++ VMT. No communication going on here.

In Windows 8 COM got extended. Now with WinRT, COM makes use of .NET metadata for language interoperation.

If Metro succeeds, many Windows developers believe Win32 might be in the legacy path, with WinRT taking over the full spectrum of Windows APIs.

"Again, C as lingua franca only works if C is the language exposed by the operating system. Lets not forget there were system programming languages before it, and after it, why should C exist forever?

And the system-development languages before it blew, which is why C was developed. And the system-development languages used after it have to be restricted; remember the above post about how C++, when used as a kernel language, can't make use of a laundry-list of features? That's because of the same problem; you can't use features that would require the generation of implicit premains, or would refer to state that the underlying system is supposed to maintain (because in a kernel, there is no underlying system). The system-development-safe part of C++ you end up with isn't much larger or much different than C.
"

C got developed, because of UNIX. If UNIX had failed in the market, most probably no one would be talking about C today.

Now UNIX got successfull, everyone wanted to have UNIX like utilities and C started to be ported everywhere.

The day, operating system vendors start using another language for systems programming, like Microsoft is doing now with Windows 8, then C starts to loose its influence in this area as well. At least in the desktop area.

If the operating system vendor does not offer you a C compiler, or C like APIs, then there is not a C interface to talk about.

You FORTRAN compiler, Ada compiler will need to support another type of interface.

This is nothing new. From what I know, there are no C like interfaces in mainframe systems, and you are forced to use whatever call convention the OS vendor decided upon.

Reply Parent Score: 2

RE[8]: C++
by boldingd on Sun 16th Sep 2012 03:06 in reply to "RE[7]: C++"
boldingd Member since:
2009-02-19

Since when? COM is all about libraries.

Your COM components can exist in separate executables, for more security. In this case a kind of local RPC is used.

However, most COM components are actually dynamic libraries that get dynamically linked with your application and follow the same format as C++ VMT. No communication going on here.

In Windows 8 COM got extended. Now with WinRT, COM makes use of .NET metadata for language interoperation.

If Metro succeeds, many Windows developers believe Win32 might be in the legacy path, with WinRT taking over the full spectrum of Windows APIs.


I'm not a Windows dev, but from what I'm reading, COM isn't a calling convention, it's an object serialization technique. You're right that it will help different OOP languages on the same underlying platform swap objects easily, but that's not the only problem I'm talking about. That works because COM support is pushed into the language run-time and underlying platform, and handled by the compiler; things change when one of the languages you're using isn't object-oriented or doesn't have usable COM bindings, like Fortran, Ada or C. Exactly the reason that C is the common language for multi-language linking is that C linking is the lowest common denominator among calling conventions, and that's still going to be true even on a platform that makes heavy use of COM in its low-level APIs.

C got developed, because of UNIX. If UNIX had failed in the market, most probably no one would be talking about C today.

Now UNIX got successfull, everyone wanted to have UNIX like utilities and C started to be ported everywhere.

The day, operating system vendors start using another language for systems programming, like Microsoft is doing now with Windows 8, then C starts to loose its influence in this area as well. At least in the desktop area.

If the operating system vendor does not offer you a C compiler, or C like APIs, then there is not a C interface to talk about.

You FORTRAN compiler, Ada compiler will need to support another type of interface.

This is nothing new. From what I know, there are no C like interfaces in mainframe systems, and you are forced to use whatever call convention the OS vendor decided upon.


"C exists because of Unix" is historically true, but you're missing the point. The reason that C came into existance was that B and BCPL - and pretty much all low-level system languages - sucked. C became popular because there was a huge need for a portable, high-level language that could still be used for low-level work. C and Unix answered real needs in the market that nobody else did; it's not as if they became popular by coincidence or clever marketing.

Reply Parent Score: 2