Re: Any basic cpp capability m4 cannot do?

Eric Blake <[email protected]> Fri, 09 May 2014 06:30:08 -0600
Newsgroups gmane.comp.gnu.m4.general
Organization Red Hat, Inc.
Message-ID <[email protected]>
On 05/08/2014 12:32 PM, Daniel Goldman wrote:

> But if the sequence already contains strings, cpp "knows" to escape the
> internal double quotes, m4 apparently does not:

But GNU m4 has the ability to regex replacement, so you can define your
m4 macro to use regexp to convert all " in the input to be \" in the
output, before adding your surrounding "" around the result.

> Thanks again. Any other differences anyone might suggest, basic
> capabilities cpp can do that m4 cannot do?

None.  m4 is Turing complete - and therefore it can do anything (just
not necessarily efficiently).  cpp can be abused to emulate Turing
completeness, although it is even hairier than m4's Turing completeness:

https://stackoverflow.com/questions/3136686/is-the-c99-preprocessor-turing-complete

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc (application/pgp-signature, 604 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCAAGBQJTbMpRAAoJEKeha0olJ0NqOKwH/2l7Fxr31S6eU2M1Ct51ppuK
B67jmcYOskV7kCzhT1hXx89zIUI5jI+N2cwEHANXm72eYiC1j+PFb5ALBU2cNemH
aJX4c6PThlrRvSNXBrWpaqY7SigEY0I05Kmu3jN7A6aoeJgC380DwR6OWeE6ad9e
drCAkPSME7E9XliLrj2EH8EqNVNu6mSAPifGENYUs+B5X+hAPZhJEoBY/TLR/b4J
zVbBTVMM4MbdfYGFE4DZCNi7akwetAtTdsm9zXeychwut1hR1gkFn5c3SiJA0hi2
1wlMDleEfbfsvVPZfH1Ru2+CJisHr1z9TqYKv6qAf+tN6c6HEvPpdtVPX8xqd0k=
=B5lU
-----END PGP SIGNATURE-----