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


Groups > comp.lang.c++ > #86934

Re: Type conversion for hundreds of lines

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.lang.c++
Subject Re: Type conversion for hundreds of lines
Date 2022-10-13 23:10 +0200
Organization A noiseless patient Spider
Message-ID <ti9urg$1sdoc$1@dont-email.me> (permalink)
References <ti797c$1it17$1@dont-email.me> <ti7bg3$1j17t$1@dont-email.me> <ti83t9$1npqf$1@dont-email.me> <ti8l30$1ouha$1@dont-email.me> <ti9i3n$1rcdk$1@dont-email.me>

Show all headers | View raw


On 13/10/2022 19:32, JiiPee wrote:
> On 13/10/2022 12:17, David Brown wrote:
>> One is to consider the code as "tried and tested" and assume it is 
>> correct.  Add warning disable pragmas at the start of the code to 
>> minimise noise.  Obviously the details here depend on the compiler and 
>> the warnings - as an example, you might have :
>>
>>      #pragma GCC diagnostic ignored "-Wsign-conversion"
> 
> good point, in old code can assume if its well tested.
> Can I disable a warning blockwise or filewise in Visual Studio?
> 

Not a clue, sorry.  I'd assume there are equivalent pragmas, but there's 
no point in my googling for you!

>>
>> Clearly this is a dangerous path - hiding the potential problems.  But 
>> maybe the code works fine in practice, as many compiler warnings are 
>> about /potential/ problems rather than real ones.
> 
> yes, if its for example tested 20 years....
> 

Of course, you can only be sure it works if your compiler today doesn't 
do any optimisations or different code generation techniques from the 
compiler of 20 years ago.

(Sometimes I work with projects that were written and tested up to 20+ 
years ago - but I archive the compiler along with the project, so that 
the generated binary is identical.)

>>
>>
>>
>> Number three is to fix the code.  That might mean changing the types 
>> of variables, refactorising, modernising, or otherwise changing the 
>> code. I'd be sceptical about simply adding static casts - the 
>> suggestion of using a function that supports optional run-time checks 
>> is probably better.
> 
> good point... rather use more sophisticated conversion function than cast.
> 

Back to comp.lang.c++ | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Type conversion for hundreds of lines JiiPee <kerrttuPoistaTama11@gmail.com> - 2022-10-12 23:48 +0300
  Re: Type conversion for hundreds of lines JiiPee <kerrttuPoistaTama11@gmail.com> - 2022-10-12 23:54 +0300
    Re: Type conversion for hundreds of lines JiiPee <kerrttuPoistaTama11@gmail.com> - 2022-10-12 23:55 +0300
      Re: Type conversion for hundreds of lines Ben Bacarisse <ben.usenet@bsb.me.uk> - 2022-10-12 23:26 +0100
        Re: Type conversion for hundreds of lines JiiPee <kerrttuPoistaTama11@gmail.com> - 2022-10-13 07:30 +0300
          Re: Type conversion for hundreds of lines Ben Bacarisse <ben.usenet@bsb.me.uk> - 2022-10-13 12:19 +0100
    Re: Type conversion for hundreds of lines Paavo Helde <eesnimi@osa.pri.ee> - 2022-10-13 00:37 +0300
      Re: Type conversion for hundreds of lines JiiPee <kerrttuPoistaTama11@gmail.com> - 2022-10-13 07:34 +0300
        Re: Type conversion for hundreds of lines Paavo Helde <eesnimi@osa.pri.ee> - 2022-10-13 11:43 +0300
  Re: Type conversion for hundreds of lines Paavo Helde <eesnimi@osa.pri.ee> - 2022-10-13 00:27 +0300
    Re: Type conversion for hundreds of lines JiiPee <kerrttuPoistaTama11@gmail.com> - 2022-10-13 07:24 +0300
      Re: Type conversion for hundreds of lines Paavo Helde <eesnimi@osa.pri.ee> - 2022-10-13 12:00 +0300
        Re: Type conversion for hundreds of lines JiiPee <kerrttuPoistaTama11@gmail.com> - 2022-10-13 20:27 +0300
      Re: Type conversion for hundreds of lines David Brown <david.brown@hesbynett.no> - 2022-10-13 11:17 +0200
        Re: Type conversion for hundreds of lines JiiPee <kerrttuPoistaTama11@gmail.com> - 2022-10-13 20:32 +0300
          Re: Type conversion for hundreds of lines Paavo Helde <eesnimi@osa.pri.ee> - 2022-10-13 21:13 +0300
            Re: Type conversion for hundreds of lines JiiPee <kerrttuPoistaTama11@gmail.com> - 2022-10-13 21:28 +0300
          Re: Type conversion for hundreds of lines David Brown <david.brown@hesbynett.no> - 2022-10-13 23:10 +0200
          Re: Type conversion for hundreds of lines Mike Terry <news.dead.person.stones@darjeeling.plus.com> - 2022-10-13 22:36 +0100
            Re: Type conversion for hundreds of lines JiiPee <kerrttuPoistaTama11@gmail.com> - 2022-10-14 07:29 +0300
  Re: Type conversion for hundreds of lines scott@slp53.sl.home (Scott Lurndal) - 2022-10-12 21:27 +0000
    Re: Type conversion for hundreds of lines JiiPee <kerrttuPoistaTama11@gmail.com> - 2022-10-13 07:25 +0300
  Re: Type conversion for hundreds of lines Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2022-10-12 14:30 -0700
    Re: Type conversion for hundreds of lines JiiPee <kerrttuPoistaTama11@gmail.com> - 2022-10-13 07:28 +0300
      Re: Type conversion for hundreds of lines "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-10-12 21:30 -0700
        Re: Type conversion for hundreds of lines JiiPee <kerrttuPoistaTama11@gmail.com> - 2022-10-13 07:37 +0300
          Re: Type conversion for hundreds of lines "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-10-13 14:18 -0700
            Re: Type conversion for hundreds of lines JiiPee <kerrttuPoistaTama11@gmail.com> - 2022-10-14 00:27 +0300
              Re: Type conversion for hundreds of lines "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-10-14 00:33 -0700
  Re: Type conversion for hundreds of lines Juha Nieminen <nospam@thanks.invalid> - 2022-10-13 07:52 +0000
    Re: Type conversion for hundreds of lines JiiPee <kerrttuPoistaTama11@gmail.com> - 2022-10-13 20:35 +0300
  Re: Type conversion for hundreds of lines Frederick Virchanza Gotham <cauldwell.thomas@gmail.com> - 2022-10-14 01:43 -0700

csiph-web