Re: C Preprocessor

2007-12-19 Thread John Meacham
On Thu, Dec 06, 2007 at 04:59:48PM +0200, Antti-Juhani Kaijanaho wrote: > On Thu, Dec 06, 2007 at 10:43:30AM +0100, Bernd Brassel wrote: > > Is it already a known problem that the preprocessor cannot cope with the > > whole set of possible string declarations? > > The cpp

Re: C Preprocessor

2007-12-06 Thread Isaac Dupree
Simon Marlow wrote: Neil Mitchell wrote: Yes, or just don't use string gaps. ++ works just as well, and GHC will optimise it away when applied to constant strings. There are also other issues, such as ' in variable names (can cause bits to be skipped in that line), /* as an operator, unboxed

Re: C Preprocessor

2007-12-06 Thread Antti-Juhani Kaijanaho
On Thu, Dec 06, 2007 at 10:43:30AM +0100, Bernd Brassel wrote: > Is it already a known problem that the preprocessor cannot cope with the > whole set of possible string declarations? The cpp is a *C* preprocessor, and if it has been written to adhere to the C standard, it is required to di

RE: C Preprocessor

2007-12-06 Thread Sittampalam, Ganesh
> > Yes, sure. (although the ' thing doesn't bite us - perhaps it doesn't > > apply with -traditional?) > I think it bit me last week. I had something like: It bites me too - something like this goes wrong with ghc -cpp: #define C(x) x foo' :: foo C(x) Ganesh ===

Re: C Preprocessor

2007-12-06 Thread Neil Mitchell
Hi Simon, > Yes, sure. (although the ' thing doesn't bite us - perhaps it doesn't > apply with -traditional?) I think it bit me last week. I had something like: #define a b foo'bar a In this case it did because "a" wasn't changed to "b". It may have been other complex things going on as well,

Re: C Preprocessor

2007-12-06 Thread Simon Marlow
Neil Mitchell wrote: Yes, or just don't use string gaps. ++ works just as well, and GHC will optimise it away when applied to constant strings. There are also other issues, such as ' in variable names (can cause bits to be skipped in that line), /* as an operator, unboxed varids in #define's

Re: C Preprocessor

2007-12-06 Thread Neil Mitchell
Hi > Yes, or just don't use string gaps. ++ works just as well, and GHC will > optimise it away when applied to constant strings. There are also other issues, such as ' in variable names (can cause bits to be skipped in that line), /* as an operator, unboxed varids in #define's Thanks Neil ___

Re: C Preprocessor

2007-12-06 Thread Simon Marlow
Wolfgang Jeltsch wrote: Am Donnerstag, 6. Dezember 2007 10:43 schrieb Bernd Brassel: Is it already a known problem that the preprocessor cannot cope with the whole set of possible string declarations? Yes, it is. There is cpphs () as an alternative. Yes,

Re: C Preprocessor

2007-12-06 Thread Wolfgang Jeltsch
Am Donnerstag, 6. Dezember 2007 10:43 schrieb Bernd Brassel: > Is it already a known problem that the preprocessor cannot cope with the > whole set of possible string declarations? Yes, it is. There is cpphs () as an alternative. > […] Best wishes, Wolfgang

C Preprocessor

2007-12-06 Thread Bernd Brassel
Is it already a known problem that the preprocessor cannot cope with the whole set of possible string declarations? $ cat long1.hs {-# OPTIONS -cpp #-} s = "abc\ \defg" main = putStrLn s $ ghc long1.hs long1.hs:3:14: lexical error in string/character literal at character 'e' $ cat lo