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


Groups > comp.arch.embedded > #18213

Re: D'oh! Oh, for lack of a code review.

From rickman <gnuarm@gmail.com>
Newsgroups comp.arch.embedded
Subject Re: D'oh! Oh, for lack of a code review.
Date 2014-09-21 22:16 -0400
Organization A noiseless patient Spider
Message-ID <lvo0pp$6c6$1@dont-email.me> (permalink)
References <hIqdnZIpiN1C3ILJnZ2dnUVZ5rKdnZ2d@giganews.com> <ZNITv.377715$yK.115461@fx14.iad> <lvnq2a$6ml$1@dont-email.me>

Show all headers | View raw


On 9/21/2014 8:21 PM, Simon Clubley wrote:
> On 2014-09-21, Clifford Heath <no.spam@please.net> wrote:
>> On 22/09/14 07:23, Tim Wescott wrote:
>>> See if YOU can find the error!
>>> if (_port.elapsed() > 0 &&
>>> 	_port.elapsed() < ((_port.clockHz() * 50LL) / 1000000))
>>
>> 0 and 1 will always be less than ((_port.clockHz() * 50LL) / 1000000)
>> Do I get a cookie?
>>
>> This is why we should be using a language with a proper type system.
>
> I've just encountered the exact same thing this evening, with unsigned
> long int being silently truncated to unsigned char without a warning.

I don't use C++ but when I did C programming I would clean my code to 
get rid of all warnings while the other coders said I was being silly as 
the warnings were just "warnings".  lol

I thought this type of thing *would* produce a warning.  Are the 
compiler flags set to not give this sort of warning?


> I needed to extend a return value from unsigned char to unsigned long
> int after a spec revealed an additional usage case. I knew there was
> additional code which needed changing but I did a quick compile just
> to check for syntax errors in the changes to that point and the damn
> thing compiled without a single warning. :-(
>
> And I agree, you wouldn't get that past an Ada compiler.
>
> Simon.
>
> PS: And yes, -Wall -Werror was enabled.

Oh, ok.

Everyone complains about the strong typing in VHDL.  It's the problems 
you don't see because you couldn't make them that it saves you from. 
Hard to show people those things.

-- 

Rick

Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

D'oh!  Oh, for lack of a code review. Tim Wescott <seemywebsite@myfooter.really> - 2014-09-21 16:23 -0500
  Re: D'oh!  Oh, for lack of a code review. Clifford Heath <no.spam@please.net> - 2014-09-22 09:02 +1000
    Re: D'oh!  Oh, for lack of a code review. Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> - 2014-09-22 00:21 +0000
      Re: D'oh!  Oh, for lack of a code review. Clifford Heath <no.spam@please.net> - 2014-09-22 10:58 +1000
        Re: D'oh! Oh, for lack of a code review. Les Cargill <lcargill99@comcast.com> - 2014-09-21 22:28 -0500
      Re: D'oh!  Oh, for lack of a code review. rickman <gnuarm@gmail.com> - 2014-09-21 22:16 -0400
    Re: D'oh!  Oh, for lack of a code review. Paul E Bennett <Paul_E.Bennett@topmail.co.uk> - 2014-09-22 01:28 +0100
      Re: D'oh!  Oh, for lack of a code review. Don Y <this@is.not.me.com> - 2014-09-21 20:16 -0700
        Re: D'oh!  Oh, for lack of a code review. Bruce Varley - 2014-09-22 11:51 +0800
          Re: D'oh!  Oh, for lack of a code review. Don Y <this@is.not.me.com> - 2014-09-21 21:19 -0700
        Re: D'oh!  Oh, for lack of a code review. Paul E Bennett <Paul_E.Bennett@topmail.co.uk> - 2014-09-22 22:20 +0100
          Re: D'oh!  Oh, for lack of a code review. Don Y <this@is.not.me.com> - 2014-09-22 16:28 -0700
            Re: D'oh!  Oh, for lack of a code review. rickman <gnuarm@gmail.com> - 2014-09-23 00:43 -0400
        Re: D'oh!  Oh, for lack of a code review. rickman <gnuarm@gmail.com> - 2014-09-22 18:48 -0400
          Re: D'oh!  Oh, for lack of a code review. Don Y <this@is.not.me.com> - 2014-09-22 15:59 -0700
            Re: D'oh!  Oh, for lack of a code review. rickman <gnuarm@gmail.com> - 2014-09-23 00:49 -0400
    Re: D'oh!  Oh, for lack of a code review. Don Y <this@is.not.me.com> - 2014-09-22 16:15 -0700
      Re: D'oh!  Oh, for lack of a code review. Don Y <this@is.not.me.com> - 2014-09-22 16:30 -0700
  Re: D'oh!  Oh, for lack of a code review. David Brown <david.brown@hesbynett.no> - 2014-09-22 10:22 +0200
  Re: D'oh!  Oh, for lack of a code review. Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2014-09-22 19:08 +0200
    Re: D'oh!  Oh, for lack of a code review. Tim Wescott <seemywebsite@myfooter.really> - 2014-09-22 13:59 -0500
      Re: D'oh!  Oh, for lack of a code review. Paul Rubin <no.email@nospam.invalid> - 2014-09-22 12:18 -0700
        Re: D'oh!  Oh, for lack of a code review. tim <tim@seemywebsite.com> - 2014-09-23 00:27 -0500
          Re: D'oh!  Oh, for lack of a code review. Robert Wessel <robertwessel2@yahoo.com> - 2014-09-23 18:35 -0500
      Re: D'oh!  Oh, for lack of a code review. David Brown <david.brown@hesbynett.no> - 2014-09-22 21:26 +0200
  Re: D'oh!  Oh, for lack of a code review. John Speth <johnspeth@yahoo.com> - 2014-09-22 16:24 -0700
    Re: D'oh!  Oh, for lack of a code review. Don Y <this@is.not.me.com> - 2014-09-22 16:34 -0700
    Re: D'oh!  Oh, for lack of a code review. rickman <gnuarm@gmail.com> - 2014-09-23 01:11 -0400

csiph-web