C Preprocessor

Isaac Dupree isaacdupree at charter.net
Thu Dec 6 10:01:53 EST 2007


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 varids in
>> #define's
> 
> Yes, sure.  (although the ' thing doesn't bite us

it seems to have bitten at least at one time: there is a workaround in 
Data.Bits (see "wsib") :

     (I# x#) `rotate` (I# i#) =
         I# (word2Int# ((x'# `uncheckedShiftL#` i'#) `or#`
                        (x'# `uncheckedShiftRL#` (wsib -# i'#))))
         where
         x'# = int2Word# x#
         i'# = word2Int# (int2Word# i# `and#` int2Word# (wsib -# 1#))
         wsib = WORD_SIZE_IN_BITS#   {- work around preprocessor problem 
(??) -}


Isaac



More information about the Glasgow-haskell-users mailing list