From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,faf964ea4531e6af X-Google-Attributes: gid103376,public X-Google-Thread: 1025b4,43ae7f61992b3213 X-Google-Attributes: gid1025b4,public From: philh@vision25.demon.co.uk (Phil Hunt) Subject: Re: GPL and "free" software Date: 1999/05/01 Message-ID: <925572182snz@vision25.demon.co.uk>#1/1 X-Deja-AN: 473010481 X-Mail2News-Path: news.demon.net!vision25.demon.co.uk References: <3729D0F6.3DF2CCED@doc.ic.ac.uk> X-Trace: mail2news.demon.co.uk 925599307 mail2news:25712 mail2news mail2news.demon.co.uk Organization: here Reply-To: philh@vision25.demon.co.uk Newsgroups: comp.lang.ada,gnu.misc.discuss X-Complaints-To: abuse@demon.net Date: 1999-05-01T00:00:00+00:00 List-Id: In article <3729D0F6.3DF2CCED@doc.ic.ac.uk> epa98@doc.ic.ac.uk "Ed Avis" writes: > David Starner wrote: > >In C terms, it would be similar to a "library" that was full of macros - > >for example: > > > >#define sqrt(a) ({int i; i = a/2; do {a = i/a;} \ > > while (a*a - i > .1); i}) > > > >You could write most of the C library that way. Now, that would > >embed a significant amount of code into the application in a way > >that dynamic linking wouldn't help. This is effectively what > >C++ templates and Ada generics do, but at a higher level. Is the ({ ... }) construct standard C and/or C++ these days? IIRC gcc supports it. > Surely not! I'm sure that templates are implemented in a slightly > more sensible way than by cutting and pasting object code - or is this > not what you meant?. Effectively this is what templates do. The difference is that templates allow more type checking than macro definitions. (Bjarne Stroustrup is on record as saying that he wishes he'd initially implemented templates as an extension to #define macros). > Can't you write a template class in C++, and put > it in a dynamically linked library? I would be surprised if this is the case. However instantiations of templates can be put in a DLL or .so. > I know that MFC, for example, > includes template classes and yet is in a DLL. -- Phil Hunt....philh@vision25.demon.co.uk