bug-m4
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

error on using $# and m4wrap


From: Hyunho Cho
Subject: error on using $# and m4wrap
Date: Sun, 26 Jul 2020 23:12:06 +0900

m4 (GNU M4) 1.4.18
Operating System: Ubuntu 20.04 LTS
Kernel: Linux 5.4.0-33-generic
Architecture: x86-64

### 1. if i define $# as macro body then error occurred

$ m4 <<\@
define(`foo', $2)
foo(100,200,300)
@

200                          # OK
---------------------

$ m4 <<\@
define(`foo', $#)
foo(100,200,300)
@
m4:stdin:1: ERROR: end of file in argument list
-----------------------

$ m4 <<\@
define(`foo', `$#')         # must quote `$#'
foo(100,200,300)
@

3                            # OK

###################################################

### 2. if i invocate m4wrap just once then return macro body

$ m4 <<\@
define(`foo', 11111)dnl
define(`bar', 22222)dnl
define(`zoo', 33333)dnl
m4wrap(`zoo')dnl
99999
@
99999
33333      <---- not zoo but 33333

$ m4 <<\@
define(`foo', 11111)dnl
define(`bar', 22222)dnl
define(`zoo', 33333)dnl
m4wrap(`foo')dnl
m4wrap(`bar')dnl
m4wrap(`zoo')dnl
99999
@
99999
zoobarfoo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]