From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Hans Vlems Newsgroups: gmane.emacs.help Subject: Re: GURU NEEDED : macro SQUARE(x) for any type x Date: Fri, 14 Jan 2011 00:14:13 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <2ed1ceee-dac4-43b2-bbdb-72e8db2bf482@b25g2000vbz.googlegroups.com> <079c3f10-9328-407e-aca3-78c8044cfafa@w17g2000yqh.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1294997494 18551 80.91.229.12 (14 Jan 2011 09:31:34 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 14 Jan 2011 09:31:34 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jan 14 10:31:30 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Pdg0I-0007K0-12 for geh-help-gnu-emacs@m.gmane.org; Fri, 14 Jan 2011 10:31:30 +0100 Original-Received: from localhost ([127.0.0.1]:42005 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pdg0H-00055k-Ba for geh-help-gnu-emacs@m.gmane.org; Fri, 14 Jan 2011 04:31:29 -0500 Original-Path: usenet.stanford.edu!postnews.google.com!l17g2000yqe.googlegroups.com!not-for-mail Original-Newsgroups: comp.lang.c,comp.lang.c++,gnu.emacs.help Original-Lines: 39 Original-NNTP-Posting-Host: 193.173.52.213 Original-X-Trace: posting.google.com 1294992853 23536 127.0.0.1 (14 Jan 2011 08:14:13 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 14 Jan 2011 08:14:13 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: l17g2000yqe.googlegroups.com; posting-host=193.173.52.213; posting-account=Od-2dQoAAAB0Ax1n9anxOF811WhPXsCz User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022),gzip(gfe) Original-Xref: usenet.stanford.edu comp.lang.c:990945 comp.lang.c++:1053366 gnu.emacs.help:184267 X-Mailman-Approved-At: Fri, 14 Jan 2011 04:24:58 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:78440 Archived-At: On 14 jan, 08:15, luser- -droog wrote: > On Jan 14, 12:46=A0am, bolega wrote: > > > > > > > Basically, I have spent a few hours experimenting and searching on the > > comp.lang.c/c++ > > > Let me use SQR for brevity and saving line > > > Here are progressively refined macros : > > > #define SQR(x) ((x)*(x)) > > > #define SQR(x) ({typedef xtype=3Dx; xtype xval=3Dx; xval*xval}) =A0// N= OTE, > > closure or {} inside () is a valid idea in C, and thus no return is > > needed. > > > this macro is given in several posts like > > >http://groups.google.com/group/comp.lang.lisp/browse_frm/thread/38ef2... > > > there is a problem with typedef > > > Bolega > > OIK > > #define SQR(x) pow((x),2) > or > #define SQR(x) exp(2 * log(x))- Tekst uit oorspronkelijk bericht niet wee= rgeven - > > - Tekst uit oorspronkelijk bericht weergeven - What happens for x=3D0 in the second example?