Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!aspect!dave From: dave@aspect.UUCP (Dave Corcoran) Newsgroups: comp.lang.c Subject: Re: initializing to expressions Summary: possible m4 solution Message-ID: <7618@aspect.UUCP> Date: 11 Feb 91 17:48:16 GMT References: <91039.144030BRL102@psuvm.psu.edu> Organization: Aspect Telecommunications, San Jose, Ca Lines: 25 In article <91039.144030BRL102@psuvm.psu.edu>, BRL102@psuvm.psu.edu (Ben Liblit) writes: > I want to initialize an array with values that are constant, but are in the > form of expressions. For example, > > double value[ 2 ] = { sqrt( 2 ) / 2, cos ( sqrt( 5 ) ) }; > > Is there *any* way to convince my compiler (High C Compiler version 2, off of a Well you said "any": define(`bc_',`syscmd(echo "$'`1"| bc -l)') double val[] = { bc_(sqrt(2) / 2), bc_(c(sqrt(5)))}; ^^^^^^^^^^ ---- any valid bc(1) expr without commas (they are interpreted by m4 as arg separators) I use trailing underscores to denote m4 macros. This is as slow as mollasses through a funnel in January though. -- David Corcoran -@@ uunet!aspect!dave ~ In a society where anything goes eventually everything will.