Hello Simon,

While building $(TOP)/libraries I found that MS CL strictly conforms to the C standard (C99) preprocessor behavior (ISO/IEC 9899:1999, Sec. 6.10, para. 2): the '#' token is recognised as a preprocessing directive if it follows a newline and whitespace. In other words, unlike the GCC preprocessor '#' does not have to be in column 0. This is a problem because people have a habit of block-quoting the GHC pragmas like this:

{-# directive
      <one or more directives>
 #-}

and of prefixing some titles with '#', such as this line in Control/ Concurrent.hs:

{- $boundthreads
   #boundthreads#

There are two solutions: either I could find some non-whitespace character to fit in before the '#' or I could go through and move every offending '#' back a line where it won't have whitespace in front of it. For the above examples:

{-# directive
      <one or more directives> #-}

{- $boundthreads   #boundthreads#

If you don't mind I would like to do just that. It is a larger change than I would like but it would not require an odd-looking (and apparently inexplicable) non-whitespace character.

On another stylistic note, CL errored out in many cases when people did not hold to the recommended GHC style convention and instead of declaring all variables first in a function instead declared them inside a separate block. For example:

Instead of:

int fun( StgOtherStruct param ) {
        StgStructTypedef q;

        if ( blah ) {
          q = param->member;
          ...
        }
}

They did this:

int fun( StgOtherStruct param ) {

        if ( blah ) {
          StgStructTypedef *q = param->member;
          ...
        }
}

This causes CL to give one of several horrid and very unhelpful errors, all based on the fact that 'StgStructTypedef', above is an invalid symbol. My fix was to pull the variable declarations out conditionally:

int fun( StgOtherStruct param ) {
#ifdef _MSC_VER
        StgStructTypedef q;
#endif

        if ( blah ) {
#ifdef _MSC_VER
          q = param->member;
#else
          StgStructTypedef *q = param->member;
#endif
          ...
        }
}

Which certainly doesn't change any non-CL behavior (it shouldn't, in any case). It is ugly and awful. Would it be o.k. for me to go through and change the variable declarations to be first in each function?

Cheers,
Pete


_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to