Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Apr 1997 14:00:48 -0700 (PDT)
From:      Jeffrey Hsu <hsu>
To:        hackers
Subject:   m4 bug?
Message-ID:  <199704212100.OAA13718@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The Solaris version of the m4 preprocessor gives the same output
for both functions below while our m4 only works for the first
definition.  The intended output is to print all of the arguments.
Is this a bug in our m4 or a buggy m4 code hidden by a bug in the
Solaris m4?  My reading of the code is that the first level of
quotes is stripped off by the m4 preprocessor in reading the definition
of iter2, so the $@ is passed without interpretation already, and hence,
should really be a $*.  That is, I think it's a bug in the Solaris m4.

----------------------------cut here--------------------------

define(iter1, `
	$1
	ifelse($2, `', `', `iter1(shift($*))')')

iter1(a, b, c)

define(iter2, `
	$1
	ifelse($2, `', `', `iter2(shift($@))')')

iter2(a, b, c)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199704212100.OAA13718>