Date: Mon, 25 Jun 2012 12:39:52 +0000 (UTC) From: jb <jb.1234abcd@gmail.com> To: freebsd-questions@freebsd.org Subject: Re: CLANG vs GCC tests of fortran/f2c program Message-ID: <loom.20120625T143324-756@post.gmane.org> References: <4FCF9333.70201@speakeasy.org> <402199FE-380B-41B6-866B-7D5D66C457D5@lpthe.jussieu.fr> <alpine.BSF.2.00.1206191952250.8234@wojtek.tensor.gdynia.pl> <alpine.BSF.2.00.1206200618290.46371@wojtek.tensor.gdynia.pl> <26.30.12873.06EE2EF4@smtp02.insight.synacor.com> <20120621230302.GB575@hemlock.hydra> <loom.20120624T221657-6@post.gmane.org> <1340574699711-5721495.post@n5.nabble.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Jakub Lach <jakub_lach <at> mailplus.pl> writes: > > > I am more concerned about an aspect of the language the clang tools are > > written in, namely the use of object-oriented paradigm of c++ (it is a > > phony > > paradigm, one that does not exist in nature or reality, which explains > > the failure rate of C++ OO projects historically and current usage > > decline). > > I sense that the relative slowness of generated code has to do with it. > > Perhaps > > some other attributes of that code's quality too, even if not now, then in > > the > > future. > > Yes, this is one thing really puzzled me. Maybe it's related to Apple's > affinity > to Objective-C? Well, let me add some more and important facts to this discussion. If it caused so much emotions and name calling, then at least everybody should know what this is all about. Clang is a compiler front-end for C, C++, Objective-C and Objective-C++ programming languages and it uses LLVM as its back-end. Both, clang and LLVM, are written in C++. LLVM provides middle layers of compilation process and is e.g. responsible for optimization of intermediate code, which next will be converted and linked into machine-dependent assembly code. Based on this source http://en.wikipedia.org/wiki/Objective-C the Objective-C was influenced by Smalltalk's object-oriented programming model, while C++ by Simula's. This has implications for characteristics and performance of Objective-C, for example: - there are quite few important language elements in C++ that are not in Objective-C, like namespaces, multiple inheritance, operator overloading, etc - "... Objective-C applications tend to be larger than similar C or C++ applications because Objective-C dynamic typing does not allow methods to be stripped or inlined." - "... Because Objective-C uses dynamic runtime typing and because all method calls are function calls (or, in some cases, syscalls), many common performance optimizations cannot be applied to Objective-C methods (for example: inlining, constant propagation, interprocedural optimizations, and scalar replacement of aggregates). This limits the performance of Objective-C abstractions relative to similar abstractions in languages such as C++ where such optimizations are possible." - "... Objective-C is decidedly geared toward run-time decisions while C++ is geared toward compile-time decisions. The tension between dynamic and static programming involves many of the classic trade-offs in programming: dynamic features add flexibility, static features add speed and type checking." My Note: please keep in mind we are talking about language used for writing clang, a compiler tool. So, Objective-C has disadvantage with regard to size od generated code, performance, and optimization as compared to C++. But both share OO (object-oriented) paradigm, which many pros consider synthetic, or pulled out of thin air if you prefer, with negative effects on devs mental health, design, and resulting code quality. I hope I got all facts right -:) It seems to me that switching to clang was a correct strategic decision for reasons linked to GPLv3 license as described in my prior post and by other thread posters. But there seems to be some price paid related to "written in C++" facts described by me in both posts, which may make some people come to a conclusion that the decision was based more on a political factor (Apple) than on technical merits. Because I did not participate or followed FreeBSD's internal process, I can not express any opinion to what extend both factors were considered and discussed. OK. Judge for yourselves, and have fun. jb
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?loom.20120625T143324-756>