m4-discuss
[Top][All Lists]
Advanced

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

Re: Any basic cpp capability m4 cannot do?


From: Eric Blake
Subject: Re: Any basic cpp capability m4 cannot do?
Date: Fri, 09 May 2014 06:30:08 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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