Changes between Version 18 and Version 19 of Guidelines/MaintenanceGuidelines


Ignore:
Timestamp:
Nov 6, 2009, 5:13:08 PM (13 years ago)
Author:
Paul A. Bristow
Comment:

BD suggested change about MS extensions

Legend:

Unmodified
Added
Removed
Modified
  • Guidelines/MaintenanceGuidelines

    v18 v19  
    5705701  Test compilation with the most pedantic setting for the compiler.
    571571
    572 For Microsoft Visual Studio, this means setting level to 4 (command line /W4),[[BR]]
    573 and disabling Microsoft language extensions Disable MS extensions = Yes, command line option /Za
     572For Microsoft Visual Studio, this means setting level to 4 (command line /W4).[[BR]]
     573For code that doesn't deliberately use Microsoft language extensions, disable them with Disable MS extensions = Yes, command line option /Za[[BR]]
    574574
    575575(You might also consider using Microsoft /Wall if available.  You may find
     
    670670If you chose to suppress (rather than fix by recoding),
    671671localise the warnings as far as possible by using push'n'pop pragmas (see above).
    672 ||Warning #||Warning||Suggestions||Suppression||
    673 
    674 ||1||C4512|| assignment operator could not be generated||Suppress using push'n'pop for the module(s) causing the warning.||//#  pragma warning(disable: 4512) // assignment operator could not be generated.||
    675 
    676 ||2|| C4996||'putenv': The POSIX name for this item is deprecated.||Many other messages about using secure versions.Unless you believe that the 'secure' versions are useful, suppress.||#  pragma warning(disable: 4996) // '' was declared deprecated.
    677 ||
    678 
    679 ||3||C4127|| conditional expression is constant||Very common and many believe unhelpful, but a few find it informative, so do not suppress globally.  Even while(true) can trigger this!  Suppress.|| #  pragma warning(disable: 4127) // conditional expression is constant.||
    680 
    681 ||4||C4100|| unreferenced formal parameter||Either surround the parameter with C comments, for example: int */ my_variable */)or just delete if the variable name is uninformative.||||
    682 
    683 5 C4701 local variable may be used without having been initialized
    684 
    685 Best is to recode to avoid the message, but if you are '''very''' sure the message is misleading, suppress.
    686 
    687  #  pragma warning(disable: 4701) // local variable may be used without having been initialized
    688 
    689 6 c4511  copy constructor could not be generated
    690 
    691 This can almost certainly be suppressed.
    692  #  pragma warning(disable: 4511) // copy constructor could not be generated
    693 
    694 7 C4180  qualifier applied to function type has no meaning; ignored
    695 
    696 This can always be suppressed - but check that you didn't mean to put the const somewhere else.
    697 
    698 8 C4702  unreachable code
    699 
    700 Be very cautious about suppressing this, but use of macros may make this troublesome,
    701 so suppress with care, and always locally.
    702 
    703  #pragma warning(disable: 4702) // unreachable code
    704 
    705 9 C4189 local variable is initialized but not referenced
    706 
    707 This probably indicates a redundant variable and assignment, so probably remove it.
    708 
    709 If you sure it is required (or has negligible cost for some documentation benefit), suppress.
    710 
    711 10  C4224 nonstandard extension used : formal parameter 'arg' was previously defined as a type.
    712 
    713 This will bite users who try to compile with Microsoft extensions disabled.
    714 So is most undesirable, but may be a major nuisance to change the names in code.
    715 However fixing is the Right Thing, but meanwhile suppressing may be helpful.
    716 
    717  #  pragma warning(disable: 4224) // formal parameter 'arg' was previously defined as a type.
    718 
    719 11 C4510  default constructor could not be generated
    720 
    721 Suppress.
    722 
    723 12 C4800 int' : forcing value to bool 'true' or 'false'
    724 
    725 Suppress.
    726 
    727 13 C4244   // Conversion: possible loss of data.
    728 
    729 Fix, for example changing type or using static_cast is best, suppress with much caution.
    730 
    731   # pragma warning(disable:4244)    // Conversion: possible loss of data.
    732 
    733 14  C4324  structure was padded due to __declspec(align())
    734 
    735 Suppress
    736 
    737 #pragma warning(disable:4324) // structure was padded due to __declspec(align())
     672||Warning||Warning Description||Suggestions||Suppression||
     673
     674||C4512|| assignment operator could not be generated||Suppress using push'n'pop for the module(s) causing the warning.||//#  pragma warning(disable: 4512) // assignment operator could not be generated.||
     675
     676|| C4996||'putenv': The POSIX name for this item is deprecated.||Many other messages about using secure versions.Unless you believe that the 'secure' versions are useful, suppress.||#  pragma warning(disable: 4996) // '' was declared deprecated.||
     677
     678||C4127|| conditional expression is constant||Very common and many believe unhelpful, but a few find it informative, so do not suppress globally.  Even while(true) can trigger this!  Suppress.|| #  pragma warning(disable: 4127) // conditional expression is constant.||
     679
     680||C4100|| unreferenced formal parameter||Either surround the parameter with C comments, for example: int */ my_variable */)or just delete if the variable name is uninformative.||||
     681
     682|| C4701|| local variable may be used without having been initialized||Best is to recode to avoid the message, but if you are '''very''' sure the message is misleading, suppress.|| #  pragma warning(disable: 4701) // local variable may be used without having been initialized||
     683
     684|| c4511||  copy constructor could not be generated||This can almost certainly be suppressed.|| #  pragma warning(disable: 4511) // copy constructor could not be generated||
     685
     686|| C4180||  qualifier applied to function type has no meaning; ignored||This can always be suppressed - but check that you didn't mean to put the const somewhere else.||#  pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored||
     687
     688|| C4702||  unreachable code||Be very cautious about suppressing this, but use of macros may make this troublesome, so suppress with care, and always locally.|| #pragma warning(disable: 4702) // unreachable code||
     689
     690|| C4189|| local variable is initialized but not referenced||This probably indicates a redundant variable and assignment, so probably remove it.If you sure it is required (or has negligible cost for some documentation benefit), suppress.||||
     691
     692||  C4224|| nonstandard extension used : formal parameter 'arg' was previously defined as a type.||This will bite users who try to compile with Microsoft extensions disabled. So is most undesirable, but may be a major nuisance to change the names in code.However fixing is the Right Thing, but meanwhile suppressing may be helpful.|| #  pragma warning(disable: 4224) // formal parameter 'arg' was previously defined as a type.||
     693
     694|| C4510||  default constructor could not be generated||Suppress.||#  pragma warning(disable: 4510)||
     695
     696|| C4800|| int' : forcing value to bool 'true' or 'false'||Suppress.||#  pragma warning(disable: 4800) // int' : forcing value to bool 'true' or 'false'
     697
     698|| C4244 ||  // Conversion: possible loss of data.||Fix, for example changing type or using static_cast is best, suppress with much caution.||  # pragma warning(disable:4244)    // Conversion: possible loss of data.||
     699
     700||  C4324||  structure was padded due to __declspec(align())||Suppress||#pragma warning(disable:4324) // structure was padded due to __declspec(align())||
    738701
    739702'''GCC'''
    740703
    741 1  class does not have a  virtual destructor
    742 
    743 Suppress or provide a virtual destructor.
    744 
     704||? || class does not have a  virtual destructor||Suppress or provide a virtual destructor.||??||
     705