Loading ...
Sorry, an error occurred while loading the content.

Re: vim7: PC-lint suggested changes (long)

Expand Messages
  • Walter Briscoe
    In message of Fri, 24 Jun 2005 12:07:58 in , Bram Moolenaar writes [snip] ... I do not hide
    Message 1 of 7 , Jun 25, 2005
    • 0 Attachment
      In message <200506241007.j5OA7w8v082753@...> of Fri, 24 Jun
      2005 12:07:58 in , Bram Moolenaar <Bram@...> writes
      [snip]

      >I never compile with NBDEBUG defined and don't see a reason to use it.
      >Just leave it out.
      I do not hide that I am looking for unimportant bugs. I am disturbed
      that you propose to leave an obscure build error in place once found.
      NBDEBUG is an interface in Make_bc5.mak, Make_cyg.mak, Make_ming.mak,
      and Make_mvc.mak. A commented removal of WIN32_LEAN_AND_MEAN seems
      reasonable to me.

      >
      >> 2) I thought #define STRICT should be used for each #include <windows.h>
      >> unless contra-indicated. (It is used for 3/11.) Did you have a specific
      >> reason for rejecting my thought or was it that its absence is not known
      >> to cause harm?
      >
      >I don't know what the effect is of defining STRICT. I don't like
      >changing things that I do not understand.
      I am relaxed about STRICT. I just don't like to see it used
      inconsistently for no known reason. MSDN article Q83456 has "... STRICT,
      which enforces the strictest possible type checking by the compiler".
      I appreciate there may be implementation bugs in this - particularly in
      implementations I do not exercise.

      A typical "HOW?" of STRICT in VC5 changes "typedef HANDLE HWND;" to
      "struct HWND__ { int unused; }; typedef struct HWND__ *HWND;".

      However, this gets no diagnostics - even at the maximum warning level:
      (I need the pragmas as Microsoft header files are not W4-clean.)
      #define STRICT
      #pragma warning(disable: 4100 4115 4201 4214 4514)
      #include <windows.h>
      #pragma warning(default: 4100 4115 4201 4214)

      void
      foo(HANDLE handle, HWND hwnd)
      {
      handle = hwnd;
      hwnd = handle;
      }

      In PC-lint, -strong(A) produces "Assignment to strong type '<name>' in
      context: assignment" diagnostics regardless of the setting of STRICT.
      Casts - signifying the type change is intentional - silence them.

      I conclude STRICT is of no use.
      Can somebody please give a small example proving me wrong?
      You can select the implementation. Please test before posting.
      I made an example from stuff in MSDN but could not get STRICT to bite.

      Thanks to Bram for removing an unfounded, comfortable feeling. ;)
      --
      Walter Briscoe
    Your message has been successfully submitted and would be delivered to recipients shortly.