Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > sci.physics > #829402

ChrisV, try this !

From Jeff-Relf.Me @.
Message-ID <Jeff-Relf.Me@Aug.1--7.41pm.Seattle.2021> (permalink)
Newsgroups comp.os.linux.advocacy, sci.physics
Subject ChrisV, try this !
Organization blocknews - www.blocknews.net
Date 2021-08-01 19:41 -0700

Cross-posted to 2 groups.

Show all headers | View raw


Try this, ChrisV !
Use " warnings as errors " and turn off these "level 4" warnings:

  c4100: unreferenced parameter.     Useful when debugging.
  c4101: unreferenced local variable.   OK when debugging.
  c4127 conditional expression is constant.

    while(1) is OK.
    "if ( ComplexExpression, 1 )" is a good debugging technique.

  c4189: local variable is initialized but not referenced.

    Variables get commented out, at times, when debugging.
    With " warnings as errors ", you don't want it to stop the debuging.
    UnUsed variables are informative, and might be needed again, later.

  c4238 nonstandard extension used: class rvalue used as lvalue.

    Needed when a simple int is (randomly) defined as an overly 
    convoluted/Byzantine class ( like ID2D1SolidColorBrush ).

  c4239 type conversion; C++ randomness.
  c4244 '=': conversion from 'int' to 'char', possible loss of data.
  c4302 conversion from a larger type to a smaller type.

  c4305 truncation from 'double' to 'float'.
  C4309 '=': truncation of constant value.
  c4310 cast truncates constant value.

  c4311 64-bit pointer truncation ( storing shorts in a pointer ).

    Implicit casting is cleaner/nicer.

  c4312 conversion from a smaller type to a larger type.
  c4430 missing type specifier - int assumed; more C++ randomness.

  c4456 declaration of 'P' hides previous local declaration.
  c4457 declaration of 'P' hides function parameter.
  c4458 declaration of 'a' hides class member.

    <D2D1helper.H> needs it, more randomness.

  c4459 declaration of 'P' hides global declaration.
       
    P ( a ShortTerm, local pointer ) is cleaner/nicer.

  c4474 'swprintf' : too many arguments passed for format string.
       
    A format string, passed to a macro, 
    might have default (unused) arguments.

  c4508 'Func': function should return a value; 'void' assumed.

    "Func() {}" is cleaner/nicer than "void Func() {}".

  c4554 check operator precedence for possible error.

    Fewer parenthesis is cleaner/nicer; just know the precedence.
    Use:  b = 1, b -= Hr - (int)Hr, b = min( HrsOffLn, b )
    Not:  b = min( HrsOffLn, ( 1 - ( b - ( Hr - (int)Hr ) ) ) )

  c4702: UnReachable code.

    A tempory "return" is needed, at times, when debugging.
    With " warnings as errors ", you don't want it to stop the debuging.

  c4706 assignment within conditional expression.
  c4709 comma operator within array index expression.

    Often, it's cleaner/nicer to assign stuff in an expression;
    same for array indices, "R_[ i++, i %= 4 ]".

  c4838 conversion from 'int' to 'wchar' requires a narrowing conversion
  c4996 'sprintf': This function may be unsafe.

    Str( Err, L"0x%x", Enum )  is cleaner/nicer than 
    swprintf_s( Err, 22, L"0x%x", Enum ).
    Global:  #define  Str  swprintf

Back to sci.physics | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

ChrisV, try this ! Jeff-Relf.Me  @. - 2021-08-01 19:41 -0700
  Re: ChrisV, try this ! rbowman <bowman@montana.com> - 2021-08-01 21:30 -0600
    Level 4 warnings only stop brain-farts, typos. Jeff-Relf.Me  @. - 2021-08-01 21:07 -0700
    Re: ChrisV, try this ! chrisv <chrisv@nospam.invalid> - 2021-08-03 10:02 -0500
  Re: ChrisV, try this ! chrisv <chrisv@nospam.invalid> - 2021-08-02 07:34 -0500

csiph-web