Using CPP in Cmm

Thorkil Naur naur at post11.tele.dk
Fri Jun 10 00:11:32 CEST 2011


Hello,

On Thu, Jun 09, 2011 at 03:44:43PM +0200, Johan Tibell wrote:
> ...
> I initially
> tried to use the CPP ## string concatenation operator to create unique
> names (tedious, but works) but GHC runs CPP in traditional mode so
> that doesn't work.

One -traditional way that I have used to concatenate pieces of C code is
demonstrated by:

> $ cat t.c
> #define s(z) z
> s(a)s(b)
> $ gcc t.c -E
> # 1 "t.c"
> # 1 "<built-in>"
> # 1 "<command-line>"
> # 1 "t.c"
>
> a b
> $ gcc t.c -E -traditional
> # 1 "t.c"
> # 1 "<built-in>"
> # 1 "<command-line>"
> # 1 "t.c"
>
> ab
> $

> ...

Best regards
Thorkil



More information about the Glasgow-haskell-users mailing list