Re: Having Trouble with m4 Input (m4 version 1.4.13)

Tom Browder <[email protected]>
Newsgroups gmane.comp.gnu.m4.general
Message-ID <[email protected]>
On Fri, Sep 3, 2010 at 11:05, Eric Blake <[email protected]> wrote:
> On 09/03/2010 09:56 AM, Tom Browder wrote:
...
>> Is the '#' stopping it?
...
>>  If so, how can I get the line I want.
...
> or by using proper quoting (so that hashdef no longer expands to a comment
> character, but a quoted string that happens to contain #):
>
> define(`hashdef', ``#'define')dnl

That doesn't work...

> Also, to be robust to non-GNU m4, you should probably also double-quote
> define, or use other tricks to ensure that you don't inadvertently end up
> expanding the define built-in with zero arguments (GNU m4 explicitly
> documents that the define built-in when invoked with zero arguments expands
> to it's own name, as if it hadn't been a macro, but POSIX leaves that bit
> unspecified):
>
> define(`hashdef', ``#define'')dnl

But that does!  So that is the recommended form for portability, no?

Thanks so much, Eric.  I'll probably have more questions before it's over.

Regards,

-Tom

Thomas M. Browder, Jr.
Niceville, Florida
USA
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.