Date: Wed, 28 Apr 2004 12:42:29 -0500 From: Jonathan Lemon <jlemon@flugsvamp.com> To: Sergey Zaharchenko <doublef@tele-kom.ru> Cc: chat@freebsd.org Subject: Re: Beginning C++ in FreeBSD Message-ID: <20040428174229.GS90558@cave.trolltruffles.com> In-Reply-To: <20040428163104.GA10537@Shark.localdomain> References: <20040425215837.3f4708fe.cpressey@catseye.mine.nu> <20040426094335.GA7578@online.fr> <20040426115842.GA4144@Shark.localdomain> <xzphdv5wq2q.fsf@dwp.des.no> <20040427160737.GA1325@Shark.localdomain> <xzpr7u918jv.fsf@dwp.des.no> <20040428023920.GA382@Shark.localdomain> <xzpfzao18gd.fsf@dwp.des.no> <20040428163104.GA10537@Shark.localdomain>
next in thread | previous in thread | raw e-mail | index | archive | help
I knew there was a good reason why I redirected -chat to /dev/null, and I'm going to restore that procmail rule in about 30 seconds. However, before I do that, I'll note this entire conversation is utterly stupid. That "feature" of C++ initializers being called on startup is simply from lib/csu/i386/c++rt0.c (or equivalent); if you really wanted the same feature in C, you'd write your own crt0.c and then call gcc with "-nostartfiles" If you don't want "main()" as your entry point, use "ld -e myfunc" instead. -- Jonathan (restoring procmail filters) Onn Wed, Apr 28, 2004 at 08:31:04PM +0400, Sergey Zaharchenko wrote: > On Wed, Apr 28, 2004 at 04:30:10PM +0200, > Dag-Erling Sm??rgrav probably wrote: > > Sergey Zaharchenko <doublef@tele-kom.ru> writes: > > > If the thesis sounds like > > > > > >> Any algorithm that can be written in one Turing-complete language can > > >> be written in another Turing-complete language. > > > > > > then I think I understand it. > > > > No. A language is Turing-complete if it can be used to implement a > > universal Turing machine. What you quote is merely a consequence of > > Turing-completeness, not its definition. > > > > OK. > > If I take out every word about main() from C's specification (making it > an ordinary function), will the resulting `language' stay > Turing-complete? If not, why? Is there an *algorithm* that I can write > in C that I can't write in this derived language? (except that I have to > run some of the functions of the resulting code from somewhere else). > > > > > > In the functional way (`what it can do') C is not different from C++, as > > > you all are pointing out (so I'm not trying to persuade you Turing was > > > wrong). It's different in what it allows you to inform the system (the > > > linker, for instance) about (and it will learn that *before* any actual > > > algorithm of yours is executed). > > > > The operating system, the C++ compiler and the linker are all written > > in C, and using C, you can write an emulator for the computer, on > > which the OS, C++ compiler and linker will behave exactly as you > > expect. > > > > [ In fact, what I described is indeed intended to be a shared library, > not a whole program... ] > > Within such emulation you will certainly be able to whatever you wish, > including dynamically linking a library which has its own initialization > in it (the constructor translated to C) to an executable. Fortunately, > you don't have to do it. > > But how do you link a real executable against an emulated shared > library:)? > > > DES > > -- > > Dag-Erling Sm?rgrav - des@des.no > > > > -- > DoubleF > Everything is worth precisely as much as a belch, the difference being > that a belch is more satisfying. > -- Ingmar Bergman
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040428174229.GS90558>